diff options
| author | deraadt <> | 1996-09-27 18:50:04 +0000 |
|---|---|---|
| committer | deraadt <> | 1996-09-27 18:50:04 +0000 |
| commit | 43ef223d5a60bdb1a88a9a2fe624015c4732ed01 (patch) | |
| tree | 863d32628c5d12fe0c86086a914805a56efb4150 /src/lib/libc/net/gethostnamadr.c | |
| parent | 2331d13ae5c6c8de49aeae1cb23a7c23f3a71b62 (diff) | |
| download | openbsd-43ef223d5a60bdb1a88a9a2fe624015c4732ed01.tar.gz openbsd-43ef223d5a60bdb1a88a9a2fe624015c4732ed01.tar.bz2 openbsd-43ef223d5a60bdb1a88a9a2fe624015c4732ed01.zip | |
more INADDRSZ pedantry
Diffstat (limited to 'src/lib/libc/net/gethostnamadr.c')
| -rw-r--r-- | src/lib/libc/net/gethostnamadr.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c index 3830e52cc6..c9220e1cf6 100644 --- a/src/lib/libc/net/gethostnamadr.c +++ b/src/lib/libc/net/gethostnamadr.c | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | #if defined(LIBC_SCCS) && !defined(lint) | 54 | #if defined(LIBC_SCCS) && !defined(lint) |
| 55 | static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.10 1996/09/27 18:37:11 deraadt Exp $"; | 55 | static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.11 1996/09/27 18:50:04 deraadt Exp $"; |
| 56 | #endif /* LIBC_SCCS and not lint */ | 56 | #endif /* LIBC_SCCS and not lint */ |
| 57 | 57 | ||
| 58 | #include <sys/param.h> | 58 | #include <sys/param.h> |
| @@ -171,6 +171,7 @@ getanswer(answer, anslen, iquery) | |||
| 171 | } | 171 | } |
| 172 | cp += n + QFIXEDSZ; | 172 | cp += n + QFIXEDSZ; |
| 173 | host.h_name = bp; | 173 | host.h_name = bp; |
| 174 | host.h_length = INADDRSZ; | ||
| 174 | n = strlen(bp); | 175 | n = strlen(bp); |
| 175 | if (n >= MAXHOSTNAMELEN) | 176 | if (n >= MAXHOSTNAMELEN) |
| 176 | host.h_name[MAXHOSTNAMELEN-1] = '\0'; | 177 | host.h_name[MAXHOSTNAMELEN-1] = '\0'; |
| @@ -240,21 +241,17 @@ getanswer(answer, anslen, iquery) | |||
| 240 | continue; | 241 | continue; |
| 241 | } | 242 | } |
| 242 | 243 | ||
| 243 | if (haveanswer) { | 244 | if (n != host.h_length) { |
| 244 | if (n != host.h_length) { | 245 | cp += n; |
| 245 | cp += n; | 246 | continue; |
| 246 | continue; | 247 | } |
| 247 | } | 248 | if (class != getclass) { |
| 248 | if (class != getclass) { | 249 | cp += n; |
| 249 | cp += n; | 250 | continue; |
| 250 | continue; | 251 | } |
| 251 | } | 252 | if (!haveanswer) { |
| 252 | } else { | ||
| 253 | host.h_length = n; | ||
| 254 | getclass = class; | 253 | getclass = class; |
| 255 | host.h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC; | 254 | host.h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC; |
| 256 | if (host.h_addrtype == AF_INET) | ||
| 257 | host.h_length = INADDRSZ; | ||
| 258 | if (!iquery) { | 255 | if (!iquery) { |
| 259 | host.h_name = bp; | 256 | host.h_name = bp; |
| 260 | bp += strlen(bp) + 1; | 257 | bp += strlen(bp) + 1; |
