Deleted Added
full compact
inet_pton.c (302408) inet_pton.c (316068)
1/*
2 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1996-2003 Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and/or 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 *

--- 156 unchanged lines hidden (view full) ---

165 if (ch == ':') {
166 curtok = src;
167 if (!seen_xdigits) {
168 if (colonp)
169 return (0);
170 colonp = tp;
171 continue;
172 }
1/*
2 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1996-2003 Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and/or 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 *

--- 156 unchanged lines hidden (view full) ---

165 if (ch == ':') {
166 curtok = src;
167 if (!seen_xdigits) {
168 if (colonp)
169 return (0);
170 colonp = tp;
171 continue;
172 }
173 if (tp + NS_INT16SZ > endp)
173 if (NS_INT16SZ > endp - tp)
174 return (0);
175 *tp++ = (unsigned char) (val >> 8) & 0xff;
176 *tp++ = (unsigned char) val & 0xff;
177 seen_xdigits = 0;
178 val = 0;
179 continue;
180 }
174 return (0);
175 *tp++ = (unsigned char) (val >> 8) & 0xff;
176 *tp++ = (unsigned char) val & 0xff;
177 seen_xdigits = 0;
178 val = 0;
179 continue;
180 }
181 if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
181 if (ch == '.' && (NS_INADDRSZ <= endp - tp) &&
182 inet_pton4(curtok, tp) > 0) {
183 tp += NS_INADDRSZ;
184 seen_xdigits = 0;
185 break; /* '\0' was seen by inet_pton4(). */
186 }
187 return (0);
188 }
189 if (seen_xdigits) {
182 inet_pton4(curtok, tp) > 0) {
183 tp += NS_INADDRSZ;
184 seen_xdigits = 0;
185 break; /* '\0' was seen by inet_pton4(). */
186 }
187 return (0);
188 }
189 if (seen_xdigits) {
190 if (tp + NS_INT16SZ > endp)
190 if (NS_INT16SZ > endp - tp)
191 return (0);
192 *tp++ = (unsigned char) (val >> 8) & 0xff;
193 *tp++ = (unsigned char) val & 0xff;
194 }
195 if (colonp != NULL) {
196 /*
197 * Since some memmove()'s erroneously fail to handle
198 * overlapping regions, we'll do the shift by hand.

--- 17 unchanged lines hidden ---
191 return (0);
192 *tp++ = (unsigned char) (val >> 8) & 0xff;
193 *tp++ = (unsigned char) val & 0xff;
194 }
195 if (colonp != NULL) {
196 /*
197 * Since some memmove()'s erroneously fail to handle
198 * overlapping regions, we'll do the shift by hand.

--- 17 unchanged lines hidden ---