From: Tobias Stoeckmann Date: Wed, 14 Aug 2024 15:52:18 +0000 (+0200) Subject: depmod: Improve P argument check X-Git-Tag: v34~515 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75b8268a26b7d29f5f383bf8a71493d27d6a1892;p=thirdparty%2Fkmod.git depmod: Improve P argument check 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 Link: https://github.com/kmod-project/kmod/pull/73 Signed-off-by: Lucas De Marchi --- diff --git a/tools/depmod.c b/tools/depmod.c index 78ab2076..94231aab 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -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; }