naccyde / rpms / systemd

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