summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpyr <pyr@openbsd.org>2009-06-05 09:52:26 +0000
committerpyr <pyr@openbsd.org>2009-06-05 09:52:26 +0000
commitfc575cae45608a8d1929b202454ed946b30066c7 (patch)
treef090accfb8018b8055badbbdb42572e0c81459b4 /lib/libc
parentuse the right accounting for bound edges (i think) (diff)
downloadwireguard-openbsd-fc575cae45608a8d1929b202454ed946b30066c7.tar.xz
wireguard-openbsd-fc575cae45608a8d1929b202454ed946b30066c7.zip
compare and shift buffer against a fixed length not strlen derived values.
ok otto@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/res_init.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c
index aafa9bbc87e..18de3550e65 100644
--- a/lib/libc/net/res_init.c
+++ b/lib/libc/net/res_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_init.c,v 1.39 2009/06/04 21:38:29 pyr Exp $ */
+/* $OpenBSD: res_init.c,v 1.40 2009/06/05 09:52:26 pyr Exp $ */
/*
* ++Copyright++ 1985, 1989, 1993
@@ -307,14 +307,14 @@ _res_init(int usercall)
cp[strcspn(cp, "\n")] = '\0';
findex = 0;
_resp->family[0] = _resp->family[1] = -1;
+#define INETLEN (sizeof("inetX") - 1)
while (*cp != '\0' && findex < 2) {
- if (!strncmp(cp, "inet6", strlen("inet6"))) {
+ if (!strncmp(cp, "inet6", INETLEN)) {
_resp->family[findex] = AF_INET6;
- cp += strlen("inet6");
- } else if (!strncmp(cp, "inet4",
- strlen("inet4"))) {
+ cp += INETLEN;
+ } else if (!strncmp(cp, "inet4", INETLEN)) {
_resp->family[findex] = AF_INET;
- cp += strlen("inet4");
+ cp += INETLEN;
} else {
_resp->family[0] = -1;
break;