From fc575cae45608a8d1929b202454ed946b30066c7 Mon Sep 17 00:00:00 2001 From: pyr Date: Fri, 5 Jun 2009 09:52:26 +0000 Subject: compare and shift buffer against a fixed length not strlen derived values. ok otto@ --- lib/libc/net/res_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/libc/net/res_init.c') 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; -- cgit v1.2.3-59-g8ed1b