dbus: fix use of `va_arg` with incorrect type
PATCH 1/1 dbus: fix use of `va_arg` with incorrect type
rule_len is computed by iterating over enum l_dbus_match_type (32-bit wide) variadic arguments, but the function also takes const char * (usually 64-bit wide) arguments. Count the arguments in the same way as they are used below to fix undefined behavior.
--- ell/dbus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
ell/dbus.c +7 -1
@@ -1825,8 +1825,14 @@ LIB_EXPORT unsigned int l_dbus_add_signal_watch(struct l_dbus *dbus,va_start (args, member); rule_len =0 ; - while (va_arg(args, enum l_dbus_match_type) != L_DBUS_MATCH_NONE) +while (true) { + type = va_arg(args, enum l_dbus_match_type); +if (type ==L_DBUS_MATCH_NONE ) +break ; + + va_arg(args, const char *); rule_len++; + }va_end (args);
Signature · 1 line
2.47.1
Denis Kenzior
AppliedHi Artem,
Quoted 8 lines · Artem Sinkevich
rule_lenis computed by iterating overenum l_dbus_match_type(32-bit wide) variadic arguments, but the function also takesconst char *(usually 64-bit wide) arguments. Count the arguments in the same way as they are used below to fix undefined behavior.--- ell/dbus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Applied, thanks!
Regards,
-Denis