]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
depmod: Improve P argument check
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 14 Aug 2024 15:52:18 +0000 (17:52 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 16 Aug 2024 04:41:41 +0000 (23:41 -0500)
The command line option P takes one argument, which is supposed to
contain exactly one character. The current check performs an out
of boundary read if an empty string is supplied.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/73
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
tools/depmod.c

index 78ab20760dd3d5a2e37315848a1b1cd1b4df1c07..94231aabff8ff1f777031d4644cbc16202d4cd77 100644 (file)
@@ -2960,7 +2960,7 @@ static int do_depmod(int argc, char *argv[])
                        out = stdout;
                        break;
                case 'P':
-                       if (optarg[1] != '\0') {
+                       if (strlen(optarg) != 1) {
                                CRIT("-P only takes a single char\n");
                                goto cmdline_failed;
                        }