summaryrefslogtreecommitdiff
path: root/src/network/inet_pton.c
AgeCommit message (Collapse)AuthorLines
2015-03-23fix internal buffer overrun in inet_ptonRich Felker-2/+3
one stop condition for parsing abbreviated ipv6 addressed was missed, allowing the internal ip[] buffer to overflow. this patch adds the missing stop condition and masks the array index so that, in case there are any remaining stop conditions missing, overflowing the buffer is not possible.
2013-12-12remove an unnecessary check in inet_ptonSzabolcs Nagy-2/+1
at most 4 hexadecimal digits are processed in one field so the value cannot overflow. the netdb.h header was not used.
2013-10-23fix inet_ptonSzabolcs Nagy-26/+19
* parse IPv4 dotted-decimal correctly (without strtoul, no leading zeros) * disallow single leading ':' in IPv6 address * allow at most 4 hex digits in IPv6 address (according to RFC 2373) * have enough hex fields in IPv4 mapped IPv6 address * disallow leading zeros in IPv4 mapped IPv6 address
2013-10-19fix return value for inet_pton in ipv6 failure casesRich Felker-6/+6
in the case of input that does not match the expected form, the correct return value is 0, not -1.
2012-09-06use restrict everywhere it's required by c99 and/or posix 2008Rich Felker-1/+1
to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
2011-04-25fix bug in ipv6 parsing that prevented parsing a lone "::"Rich Felker-4/+1
2011-04-25ipv6 parsing code (formerly dummied-out)Rich Felker-6/+56
2011-04-21fix bogus return values for inet_ptonRich Felker-2/+2
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+31