aboutsummaryrefslogtreecommitdiffstats
path: root/libc/netbsd/gethnamaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/netbsd/gethnamaddr.c')
-rw-r--r--libc/netbsd/gethnamaddr.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libc/netbsd/gethnamaddr.c b/libc/netbsd/gethnamaddr.c
index 5b2f98750..c86d58dea 100644
--- a/libc/netbsd/gethnamaddr.c
+++ b/libc/netbsd/gethnamaddr.c
@@ -159,15 +159,12 @@ dprintf(const char *msg, res_state res, ...)
#define BOUNDED_INCR(x) \
do { \
cp += (x); \
- if (cp > eom) { \
- h_errno = NO_RECOVERY; \
- return NULL; \
- } \
+ BOUNDS_CHECK(cp, x); \
} while (/*CONSTCOND*/0)
#define BOUNDS_CHECK(ptr, count) \
do { \
- if ((ptr) + (count) > eom) { \
+ if (eom - (ptr) < (count)) {\
h_errno = NO_RECOVERY; \
return NULL; \
} \