From: Lennart Poettering Date: Tue, 1 Feb 2022 11:06:21 +0000 (+0100) Subject: util: another set of CVE-2021-4034 assert()s X-Git-Tag: v251-rc1~393 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=007e03b284e8ffc0b92edb2122cd9d2d16f049ef;p=thirdparty%2Fsystemd.git util: another set of CVE-2021-4034 assert()s It's a good idea that we validate argc/argv when we are supposed to store them away. --- diff --git a/src/basic/util.h b/src/basic/util.h index 94804f28e3f..68ae3b51e0e 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -9,6 +9,12 @@ extern int saved_argc; extern char **saved_argv; static inline void save_argc_argv(int argc, char **argv) { + + /* Protect against CVE-2021-4034 style attacks */ + assert_se(argc > 0); + assert_se(argv); + assert_se(argv[0]); + saved_argc = argc; saved_argv = argv; }