diff options
Diffstat (limited to 'lib/isc/inet_pton.c')
-rw-r--r-- | lib/isc/inet_pton.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/isc/inet_pton.c b/lib/isc/inet_pton.c index 6bada239e0e5..4c60f8252f4a 100644 --- a/lib/isc/inet_pton.c +++ b/lib/isc/inet_pton.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1996-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -44,7 +44,7 @@ static char rcsid[] = static int inet_pton4(const char *src, unsigned char *dst); static int inet_pton6(const char *src, unsigned char *dst); -/*% +/*% * convert from presentation format (which usually means ASCII printable) * to network format (which is usually some kind of binary format). * \return @@ -91,8 +91,9 @@ inet_pton4(const char *src, unsigned char *dst) { const char *pch; if ((pch = strchr(digits, ch)) != NULL) { - unsigned int new = *tp * 10 + (pch - digits); + unsigned int new = *tp * 10; + new += (int)(pch - digits); if (saw_digit && *tp == 0) return (0); if (new > 255) @@ -113,7 +114,7 @@ inet_pton4(const char *src, unsigned char *dst) { } if (octets < 4) return (0); - memcpy(dst, tmp, NS_INADDRSZ); + memmove(dst, tmp, NS_INADDRSZ); return (1); } @@ -196,7 +197,7 @@ inet_pton6(const char *src, unsigned char *dst) { * Since some memmove()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ - const int n = tp - colonp; + const int n = (int)(tp - colonp); int i; if (tp == endp) @@ -209,6 +210,6 @@ inet_pton6(const char *src, unsigned char *dst) { } if (tp != endp) return (0); - memcpy(dst, tmp, NS_IN6ADDRSZ); + memmove(dst, tmp, NS_IN6ADDRSZ); return (1); } |