]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
exec-invoke: correct dont_close[] size
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Apr 2024 19:49:12 +0000 (21:49 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 24 Apr 2024 13:09:28 +0000 (15:09 +0200)
THis needs 15 entries as far as I can count, not just 14.

Follow-up for: 5686391b006ee82d8a4559067ad9818e3e631247

Sniff.

src/core/exec-invoke.c

index ff0fdbec5ff8f719af7b489af620c240c9067596..8b16acb399ca9457ce84c456d06fc4c485f9590f 100644 (file)
@@ -3519,7 +3519,7 @@ static int close_remaining_fds(
                 const int *fds, size_t n_fds) {
 
         size_t n_dont_close = 0;
-        int dont_close[n_fds + 14];
+        int dont_close[n_fds + 15];
 
         assert(params);
 
@@ -3555,6 +3555,8 @@ static int close_remaining_fds(
         if (params->user_lookup_fd >= 0)
                 dont_close[n_dont_close++] = params->user_lookup_fd;
 
+        assert(n_dont_close <= ELEMENTSOF(dont_close));
+
         return close_all_fds(dont_close, n_dont_close);
 }