naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame SOURCES/0103-tc-tc_filter-Make-sure-filter-name-is-not-empty.patch

36cfb7
From a4c190565a85db814ad1185ada5382e7fb8707a0 Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 29 Apr 2019 20:08:08 +0200
36cfb7
Subject: [PATCH] tc/tc_filter: Make sure filter name is not empty
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
36cfb7
Upstream Status: iproute2.git commit 75716932a0af2
36cfb7
36cfb7
commit 75716932a0af28da207aa57c212794ab28ce9036
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Thu Aug 24 11:46:33 2017 +0200
36cfb7
36cfb7
    tc/tc_filter: Make sure filter name is not empty
36cfb7
36cfb7
    The later check for 'k[0] != 0' requires a non-empty filter name,
36cfb7
    otherwise NULL pointer dereference in 'q' might happen.
36cfb7
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 tc/tc_filter.c | 3 +++
36cfb7
 1 file changed, 3 insertions(+)
36cfb7
36cfb7
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
36cfb7
index e640492b25ba6..a6bb73d12eaba 100644
36cfb7
--- a/tc/tc_filter.c
36cfb7
+++ b/tc/tc_filter.c
36cfb7
@@ -380,6 +380,9 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv)
36cfb7
 			usage();
36cfb7
 			return 0;
36cfb7
 		} else {
36cfb7
+			if (!**argv)
36cfb7
+				invarg("invalid filter name", *argv);
36cfb7
+
36cfb7
 			strncpy(k, *argv, sizeof(k)-1);
36cfb7
 
36cfb7
 			q = get_filter_kind(k);
36cfb7
-- 
e138d9
2.21.0
36cfb7