On Tue, 25.11.14 10:01, David Herrmann (dh.herrm...@gmail.com) wrote:

> char fmt[LINE_MAX];
> 
> snprintf(fmt, sizeof(fmt), "libxkbcommon: %s", format);
> e = xkb_context_get_user_data(ctx);
> bus_error_setfv(e, SD_BUS_ERROR_INVALID_ARGS, fmt, args);
> 
> We use LINE_MAX as explicit limit on a lot of these calls (and I think
> it makes sense to prevent unbound allocations).

I think "strappenda()" is more appropriate. Format strings are
generally *not* unbounded in their length.

LINE_MAX is the best way to chicken out of doing precise allocations
of things, but it's still chickening out. And since format strings ar
not unbounded in their size we really should use strappenda() for
it. And if not, then at least "strappend()"...

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to