inet_net_pton.c (170244) | inet_net_pton.c (186090) |
---|---|
1/* 2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 3 * Copyright (c) 1996,1999 by Internet Software Consortium. 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18#if defined(LIBC_SCCS) && !defined(lint) | 1/* 2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 3 * Copyright (c) 1996,1999 by Internet Software Consortium. 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18#if defined(LIBC_SCCS) && !defined(lint) |
19static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $"; | 19static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $"; |
20#endif 21#include <sys/cdefs.h> | 20#endif 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/lib/libc/inet/inet_net_pton.c 170244 2007-06-03 17:20:27Z ume $"); | 22__FBSDID("$FreeBSD: head/lib/libc/inet/inet_net_pton.c 186090 2008-12-14 19:39:53Z ume $"); |
23 24#include "port_before.h" 25 26#include <sys/types.h> 27#include <sys/socket.h> 28#include <netinet/in.h> 29#include <arpa/nameser.h> 30#include <arpa/inet.h> --- 99 unchanged lines hidden (view full) --- 130 /* CIDR width specifier. Nothing can follow it. */ 131 ch = *src++; /*%< Skip over the /. */ 132 bits = 0; 133 do { 134 n = strchr(digits, ch) - digits; 135 assert(n >= 0 && n <= 9); 136 bits *= 10; 137 bits += n; | 23 24#include "port_before.h" 25 26#include <sys/types.h> 27#include <sys/socket.h> 28#include <netinet/in.h> 29#include <arpa/nameser.h> 30#include <arpa/inet.h> --- 99 unchanged lines hidden (view full) --- 130 /* CIDR width specifier. Nothing can follow it. */ 131 ch = *src++; /*%< Skip over the /. */ 132 bits = 0; 133 do { 134 n = strchr(digits, ch) - digits; 135 assert(n >= 0 && n <= 9); 136 bits *= 10; 137 bits += n; |
138 if (bits > 32) 139 goto enoent; |
|
138 } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); 139 if (ch != '\0') 140 goto enoent; | 140 } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); 141 if (ch != '\0') 142 goto enoent; |
141 if (bits > 32) 142 goto emsgsize; | |
143 } 144 145 /* Firey death and destruction unless we prefetched EOS. */ 146 if (ch != '\0') 147 goto enoent; 148 149 /* If nothing was written to the destination, we found no address. */ 150 if (dst == odst) --- 266 unchanged lines hidden --- | 143 } 144 145 /* Firey death and destruction unless we prefetched EOS. */ 146 if (ch != '\0') 147 goto enoent; 148 149 /* If nothing was written to the destination, we found no address. */ 150 if (dst == odst) --- 266 unchanged lines hidden --- |