From: Jeffrey Altman Date: Thu, 6 Nov 2008 22:09:18 +0000 (+0000) Subject: DEVEL15-windows-config-ipaddr-parsing-20081106 X-Git-Tag: openafs-devel-1_5_55~13 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8e2387404cfb9f1bddba57e3813346b78ef6a4d0;p=packages%2Fo%2Fopenafs.git DEVEL15-windows-config-ipaddr-parsing-20081106 LICENSE MIT when parsing ipaddrs in CellServDB rejects addrs whose components are values greater than 255. (cherry picked from commit 68902640a2eb1d47d7dd13b3fae9d19eddf64a6e) --- diff --git a/src/WINNT/afsd/cm_config.c b/src/WINNT/afsd/cm_config.c index 5fbaf7010..b15f9738d 100644 --- a/src/WINNT/afsd/cm_config.c +++ b/src/WINNT/afsd/cm_config.c @@ -299,16 +299,16 @@ long cm_SearchCellFileEx(char *cellNamep, char *newCellNamep, } if (!thp) { afs_uint32 ip_addr; - int c1, c2, c3, c4; + unsigned int c1, c2, c3, c4; /* Since there is no gethostbyname() data * available we will read the IP address * stored in the CellServDB file */ - code = sscanf(lineBuffer, " %d.%d.%d.%d", + code = sscanf(lineBuffer, " %u.%u.%u.%u", &c1, &c2, &c3, &c4); - if (code == 4) { - tp = (char *) &ip_addr; + if (code == 4 && c1<256 && c2<256 && c3<256 && c4<256) { + tp = (unsigned char *) &ip_addr; *tp++ = c1; *tp++ = c2; *tp++ = c3;