From: ajs Date: Tue, 26 Jul 2005 14:35:37 +0000 (+0000) Subject: 2005-07-26 Andrew J. Schorr X-Git-Tag: frr-2.0-rc1~2958 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=330009f7b3742462ebd90f9c16f1ab734344b68c;p=matthieu%2Ffrr.git 2005-07-26 Andrew J. Schorr * prefix.c: (ip_masklen) While loop should test that 'pnt' pointer is in range before dereferencing it. [backport candidate] --- diff --git a/lib/ChangeLog b/lib/ChangeLog index aed287449e..f67f2c1e52 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2005-07-26 Andrew J. Schorr + + * prefix.c: (ip_masklen) While loop should test that 'pnt' pointer is + in range before dereferencing it. + 2005-06-24 Pawel Worach * getopt.h: add further tests for full getopt declaration on diff --git a/lib/prefix.c b/lib/prefix.c index b4347dd222..1806ac4987 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -292,7 +292,7 @@ ip_masklen (struct in_addr netmask) pnt = (u_char *) &netmask; end = pnt + 4; - while ((*pnt == 0xff) && pnt < end) + while ((pnt < end) && (*pnt == 0xff)) { len+= 8; pnt++;