don't accept invalid form of an address like 1:2:3:4:5:6:7::8.

PR:		bin/84106
Obtained from:	BIND9
MFC after:	2 days
This commit is contained in:
Hajimu UMEMOTO 2005-07-27 14:33:36 +00:00
parent d0e98e85f8
commit 5495564735
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148446

View file

@ -88,6 +88,8 @@ inet_pton4(const char *src, u_char *dst)
if ((pch = strchr(digits, ch)) != NULL) {
u_int new = *tp * 10 + (pch - digits);
if (saw_digit && *tp == 0)
return (0);
if (new > 255)
return (0);
*tp = new;
@ -195,6 +197,8 @@ inet_pton6(const char *src, u_char *dst)
const int n = tp - colonp;
int i;
if (tp == endp)
return (0);
for (i = 1; i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;