]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
random-seed: terminate the option array
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 25 Oct 2023 17:25:38 +0000 (19:25 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 25 Oct 2023 19:41:46 +0000 (20:41 +0100)
So we don't crash on invalid options:

$ build/systemd-random-seed --foo
Segmentation fault (core dumped)

src/random-seed/random-seed.c

index 25d4d3f584c5cfce7fcf80b154a79789294ab6ab..12eb1f7eac833364d07c00ae5a03d8eef12451f1 100644 (file)
@@ -348,6 +348,7 @@ static int parse_argv(int argc, char *argv[]) {
         static const struct option options[] = {
                 { "help",    no_argument, NULL, 'h'         },
                 { "version", no_argument, NULL, ARG_VERSION },
+                {}
         };
 
         int c;