]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/strv: check printf arguments to strv_extendf() 25470/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 21 Nov 2022 19:06:55 +0000 (20:06 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 21 Nov 2022 19:08:50 +0000 (20:08 +0100)
The second argument to _printf_() specifies where the arguments start. We need to
use 0 in two cases: when the args in a va_list and can't be checked, and with journald
logging functions which accept multiple format strings with multiple argument sets,
which the _printf_ checker does not understand. But strv_extendf() can be checked.

src/basic/strv.h

index 87a7038a54744ab18b9cf4b89a00ed86db4e5a78..f82c76589d06a5b99988074d0a85caf874f48435 100644 (file)
@@ -45,7 +45,7 @@ static inline int strv_extend(char ***l, const char *value) {
         return strv_extend_with_size(l, NULL, value);
 }
 
-int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
+int strv_extendf(char ***l, const char *format, ...) _printf_(2,3);
 int strv_extend_front(char ***l, const char *value);
 
 int strv_push_with_size(char ***l, size_t *n, char *value);