On (25/06/14 10:51), Simo Sorce wrote:
On Tue, 2014-06-24 at 17:28 +0200, Pavel Reichl wrote:
> > Error: PW.NON_CONST_PRINTF_FORMAT_STRING:
> > sssd-1.11.92/src/db/sysdb_ops.c:109: non_const_printf_format_string:
> format string is not a string literal, potential security
> vulnerability if user controlled
> > sssd-1.11.92/src/db/sysdb_ops.c:109: caretline:
> >
> > I prefer to avoid compiler warnings. It will be better to use NULL.
>
> (lret = ldb_search(ldb, mem_ctx, _result, base, scope, attrs, NULL);)
>
> It's a common practice in SSSD anyway.
Wouldn't it be simpler to use a macro in this case ?
Your new fuinction hjas to go through variadic expansion prematurely,
and adds a lot of code:
something like:
#define sss_ldbn_seartch(ret, arguments, etc., format, ...) {
I was thinking about
variadic macro, but i wanted to simulate function.
ret = macro_sss_ldbn_seartch(...)
It is a realy nice trick.
do {
int result = ldb_search(argumets, etc, format, ##__VA_ARGS__);
ret = result;
if (res->count == 0) {
ret = ENOENT;
}
} while(0);
LS