diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2009-06-05 09:52:27 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2009-06-05 09:52:27 +0000 |
commit | a42b4b90807134280e27cf5528f4e748387ccf6f (patch) | |
tree | 4e236c1fcb444f123f9519182f284864dc055810 /lib | |
parent | e0357a7a1d2047a7829f4d3dd82115eae985f9be (diff) |
compare and shift buffer against a fixed length not strlen derived values.
ok otto@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/res_init.c | 12 |
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; |