richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ac3a84
From c103428e24f002e495412a5f9a0b919f4b92c2b7 Mon Sep 17 00:00:00 2001
ac3a84
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
ac3a84
Date: Mon, 21 Nov 2022 20:06:55 +0100
ac3a84
Subject: [PATCH] basic/strv: check printf arguments to strv_extendf()
ac3a84
ac3a84
The second argument to _printf_() specifies where the arguments start. We need to
ac3a84
use 0 in two cases: when the args in a va_list and can't be checked, and with journald
ac3a84
logging functions which accept multiple format strings with multiple argument sets,
ac3a84
which the _printf_ checker does not understand. But strv_extendf() can be checked.
ac3a84
ac3a84
(cherry picked from commit 400102ec91aa3404848a04f49a43d49e1a181708)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/basic/strv.h | 2 +-
ac3a84
 1 file changed, 1 insertion(+), 1 deletion(-)
ac3a84
ac3a84
diff --git a/src/basic/strv.h b/src/basic/strv.h
ac3a84
index d6f5ac6ba5..6c9fa47943 100644
ac3a84
--- a/src/basic/strv.h
ac3a84
+++ b/src/basic/strv.h
ac3a84
@@ -45,7 +45,7 @@ static inline int strv_extend(char ***l, const char *value) {
ac3a84
         return strv_extend_with_size(l, NULL, value);
ac3a84
 }
ac3a84
 
ac3a84
-int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
ac3a84
+int strv_extendf(char ***l, const char *format, ...) _printf_(2,3);
ac3a84
 int strv_extend_front(char ***l, const char *value);
ac3a84
 
ac3a84
 int strv_push_with_size(char ***l, size_t *n, char *value);