]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc/tc_filter: Make sure filter name is not empty
authorPhil Sutter <phil@nwl.cc>
Thu, 24 Aug 2017 09:46:33 +0000 (11:46 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 24 Aug 2017 21:49:44 +0000 (14:49 -0700)
The later check for 'k[0] != 0' requires a non-empty filter name,
otherwise NULL pointer dereference in 'q' might happen.

Signed-off-by: Phil Sutter <phil@nwl.cc>
tc/tc_filter.c

index b13fb9185d4fdabe1b49080493419e74dbff70cb..cf290ae8e252c50bbdc5c79ac80f04350ce0faa2 100644 (file)
@@ -412,6 +412,9 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv)
                        usage();
                        return 0;
                } else {
+                       if (!**argv)
+                               invarg("invalid filter name", *argv);
+
                        strncpy(k, *argv, sizeof(k)-1);
 
                        q = get_filter_kind(k);