systemd/SOURCES/0066-core-check-if-argc-0-and-argv-0-is-set.patch
2022-11-15 07:41:42 +00:00

28 lines
820 B
Diff

From efe174ec51b9242101868e83f12cc1186fe1b71b Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 30 Jan 2022 17:54:55 +0900
Subject: [PATCH] core: check if argc > 0 and argv[0] is set
Follow-up for 1637e757070a61b12b26a2a4ef547330562dc77f.
(cherry picked from commit cf3095ac2bbdba3db0d8f7fa7afcee8b8c136201)
Related: #2017035
---
src/core/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/core/main.c b/src/core/main.c
index 7ea848ebeb..f315a44a08 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -2726,6 +2726,8 @@ int main(int argc, char *argv[]) {
Manager *m = NULL;
FDSet *fds = NULL;
+ assert(argc > 0 && !isempty(argv[0]));
+
/* SysV compatibility: redirect init → telinit */
redirect_telinit(argc, argv);