diff options
author | deraadt <> | 2002-07-25 21:13:45 +0000 |
---|---|---|
committer | deraadt <> | 2002-07-25 21:13:45 +0000 |
commit | 38f8ca9fa51b59794faf1c8ca4e9b1b7c06eeb42 (patch) | |
tree | fd08b36ec9599d78879914d7983488f0e1e5155e /src/lib/libc/net/getaddrinfo.c | |
parent | f60b3a80fab33686119eda8629a7cbe8319cc074 (diff) | |
download | openbsd-38f8ca9fa51b59794faf1c8ca4e9b1b7c06eeb42.tar.gz openbsd-38f8ca9fa51b59794faf1c8ca4e9b1b7c06eeb42.tar.bz2 openbsd-38f8ca9fa51b59794faf1c8ca4e9b1b7c06eeb42.zip |
kill more strcpy
Diffstat (limited to 'src/lib/libc/net/getaddrinfo.c')
-rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index 364bffedeb..744852bed7 100644 --- a/src/lib/libc/net/getaddrinfo.c +++ b/src/lib/libc/net/getaddrinfo.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getaddrinfo.c,v 1.40 2002/07/24 01:38:34 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.41 2002/07/25 21:13:45 deraadt Exp $ */ |
2 | /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ | 2 | /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ |
3 | 3 | ||
4 | /* | 4 | /* |
@@ -543,11 +543,11 @@ explore_fqdn(pai, hostname, servname, res) | |||
543 | } | 543 | } |
544 | 544 | ||
545 | if ((_res.options & RES_INIT) == 0 && res_init() == -1) | 545 | if ((_res.options & RES_INIT) == 0 && res_init() == -1) |
546 | strncpy(lookups, "f", sizeof lookups); | 546 | strlcpy(lookups, "f", sizeof lookups); |
547 | else { | 547 | else { |
548 | bcopy(_res.lookups, lookups, sizeof lookups); | 548 | bcopy(_res.lookups, lookups, sizeof lookups); |
549 | if (lookups[0] == '\0') | 549 | if (lookups[0] == '\0') |
550 | strncpy(lookups, "bf", sizeof lookups); | 550 | strlcpy(lookups, "bf", sizeof lookups); |
551 | } | 551 | } |
552 | 552 | ||
553 | for (i = 0; i < MAXDNSLUS && result == NULL && lookups[i]; i++) { | 553 | for (i = 0; i < MAXDNSLUS && result == NULL && lookups[i]; i++) { |
@@ -818,10 +818,9 @@ get_canonname(pai, ai, str) | |||
818 | const char *str; | 818 | const char *str; |
819 | { | 819 | { |
820 | if ((pai->ai_flags & AI_CANONNAME) != 0) { | 820 | if ((pai->ai_flags & AI_CANONNAME) != 0) { |
821 | ai->ai_canonname = (char *)malloc(strlen(str) + 1); | 821 | ai->ai_canonname = strdup(str); |
822 | if (ai->ai_canonname == NULL) | 822 | if (ai->ai_canonname == NULL) |
823 | return EAI_MEMORY; | 823 | return EAI_MEMORY; |
824 | strcpy(ai->ai_canonname, str); | ||
825 | } | 824 | } |
826 | return 0; | 825 | return 0; |
827 | } | 826 | } |