Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/lib/libc/net Pull up revision 1.38 (requested by tv in ...



details:   https://anonhg.NetBSD.org/src/rev/a402b167363a
branches:  netbsd-1-6
changeset: 527609:a402b167363a
user:      tv <tv%NetBSD.org@localhost>
date:      Wed May 29 18:01:22 2002 +0000

description:
Pull up revision 1.38 (requested by tv in ticket #66):
use strlcpy, not strcpy

diffstat:

 lib/libc/net/getnameinfo.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r e5fb00ae392b -r a402b167363a lib/libc/net/getnameinfo.c
--- a/lib/libc/net/getnameinfo.c        Wed May 29 16:32:57 2002 +0000
+++ b/lib/libc/net/getnameinfo.c        Wed May 29 18:01:22 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnameinfo.c,v 1.37.2.1 2002/05/25 18:18:56 thorpej Exp $     */
+/*     $NetBSD: getnameinfo.c,v 1.37.2.2 2002/05/29 18:01:22 tv Exp $  */
 /*     $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $    */
 
 /*
@@ -47,7 +47,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getnameinfo.c,v 1.37.2.1 2002/05/25 18:18:56 thorpej Exp $");
+__RCSID("$NetBSD: getnameinfo.c,v 1.37.2.2 2002/05/29 18:01:22 tv Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -200,12 +200,12 @@
                if (sp) {
                        if (strlen(sp->s_name) + 1 > servlen)
                                return EAI_MEMORY;
-                       strcpy(serv, sp->s_name);
+                       strlcpy(serv, sp->s_name, servlen);
                } else {
                        snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
                        if (strlen(numserv) + 1 > servlen)
                                return EAI_MEMORY;
-                       strcpy(serv, numserv);
+                       strlcpy(serv, numserv, servlen);
                }
        }
 
@@ -279,7 +279,7 @@
                        numaddrlen = strlen(numaddr);
                        if (numaddrlen + 1 > hostlen) /* don't forget terminator */
                                return EAI_MEMORY;
-                       strcpy(host, numaddr);
+                       strlcpy(host, numaddr, hostlen);
                        break;
                }
        } else {
@@ -301,7 +301,7 @@
                        if (strlen(hp->h_name) + 1 > hostlen) {
                                return EAI_MEMORY;
                        }
-                       strcpy(host, hp->h_name);
+                       strlcpy(host, hp->h_name, hostlen);
                } else {
                        if (flags & NI_NAMEREQD)
                                return EAI_NONAME;
@@ -351,7 +351,7 @@
        numaddrlen = strlen(numaddr);
        if (numaddrlen + 1 > hostlen) /* don't forget terminator */
                return EAI_MEMORY;
-       strcpy(host, numaddr);
+       strlcpy(host, numaddr, hostlen);
 
        if (((const struct sockaddr_in6 *)(const void *)sa)->sin6_scope_id) {
                char zonebuf[MAXHOSTNAMELEN];



Home | Main Index | Thread Index | Old Index