summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/lib/isc/inet_pton.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/lib/isc/inet_pton.c')
-rw-r--r--contrib/ntp/lib/isc/inet_pton.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/ntp/lib/isc/inet_pton.c b/contrib/ntp/lib/isc/inet_pton.c
index eac631b..7e07667 100644
--- a/contrib/ntp/lib/isc/inet_pton.c
+++ b/contrib/ntp/lib/isc/inet_pton.c
@@ -170,7 +170,7 @@ inet_pton6(const char *src, unsigned char *dst) {
colonp = tp;
continue;
}
- if (tp + NS_INT16SZ > endp)
+ if (NS_INT16SZ > endp - tp)
return (0);
*tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (unsigned char) val & 0xff;
@@ -178,7 +178,7 @@ inet_pton6(const char *src, unsigned char *dst) {
val = 0;
continue;
}
- if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+ if (ch == '.' && (NS_INADDRSZ <= endp - tp) &&
inet_pton4(curtok, tp) > 0) {
tp += NS_INADDRSZ;
seen_xdigits = 0;
@@ -187,7 +187,7 @@ inet_pton6(const char *src, unsigned char *dst) {
return (0);
}
if (seen_xdigits) {
- if (tp + NS_INT16SZ > endp)
+ if (NS_INT16SZ > endp - tp)
return (0);
*tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (unsigned char) val & 0xff;
OpenPOWER on IntegriCloud