From a8b303cc3f5a867539cec4215f856de4f69606a6 Mon Sep 17 00:00:00 2001 From: "osdl.net!shemminger" Date: Mon, 7 Feb 2005 18:16:29 +0000 Subject: [PATCH] validate classid (Logical change 1.137) --- ChangeLog | 4 ++++ tc/tc_util.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 68efd800..f3560c66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-02-07 Stephen Hemminger + + * Validate classid is not too large to cause loss of bits. + 2005-02-07 Jean-Marc Ranger * need to call getline() with null for first usage diff --git a/tc/tc_util.c b/tc/tc_util.c index 0dc76c03..a6413e66 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -61,11 +61,15 @@ int get_tc_classid(__u32 *h, const char *str) return -1; } if (*p == ':') { + if (maj >= (1<<16)) + return -1; maj <<= 16; str = p+1; min = strtoul(str, &p, 16); if (*p != 0) return -1; + if (min >= (1<<16)) + return -1; maj |= min; } else if (*p != 0) return -1;