From 75716932a0af28da207aa57c212794ab28ce9036 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 24 Aug 2017 11:46:33 +0200 Subject: [PATCH] tc/tc_filter: Make sure filter name is not empty 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 --- tc/tc_filter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tc/tc_filter.c b/tc/tc_filter.c index b13fb9185..cf290ae8e 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -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); -- 2.47.2