]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
depmod: Don't fall back to uname on bad version
authorLaura Abbott <labbott@fedoraproject.org>
Mon, 28 Sep 2015 22:39:14 +0000 (15:39 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 30 Sep 2015 18:17:05 +0000 (15:17 -0300)
Currently, if a value that doesn't match a kernel version
("%u.%u") is passed in, depmod silently falls back to
using uname. Rather than try and work around the caller passing
bad data, just exit out instead.

tools/depmod.c

index 348735f9aa239e3be9a3f82a3a1924b7d2f7f1d1..a585d47516ff7a5b3b833cc666a8f2348d190a98 100644 (file)
@@ -2476,7 +2476,11 @@ static int do_depmod(int argc, char *argv[])
                }
        }
 
-       if (optind < argc && is_version_number(argv[optind])) {
+       if (optind < argc) {
+               if (!is_version_number(argv[optind])) {
+                       ERR("Bad version passed %s\n", argv[optind]);
+                       goto cmdline_failed;
+               }
                cfg.kversion = argv[optind];
                optind++;
        } else {