Source-Changes-HG archive

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

[src/netbsd-1-5]: src/lib/libc/net pullup 1.21 -> 1.23 (approved by releng-1-5)



details:   https://anonhg.NetBSD.org/src/rev/93e6c2046b9a
branches:  netbsd-1-5
changeset: 489532:93e6c2046b9a
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Sep 25 23:39:14 2000 +0000

description:
pullup 1.21 -> 1.23 (approved by releng-1-5)

 > off-by-1 error in string length validation.
 > From: Pavel Kankovsky <peak%argo.troja.mff.cuni.cz@localhost>

diffstat:

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

diffs (44 lines):

diff -r cdba82e0a791 -r 93e6c2046b9a lib/libc/net/getnameinfo.c
--- a/lib/libc/net/getnameinfo.c        Mon Sep 25 22:17:52 2000 +0000
+++ b/lib/libc/net/getnameinfo.c        Mon Sep 25 23:39:14 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: getnameinfo.c,v 1.19 2000/06/12 04:27:58 itojun Exp $  */
-/*     $KAME: getnameinfo.c,v 1.43 2000/06/12 04:27:03 itojun Exp $    */
+/*     $NetBSD: getnameinfo.c,v 1.19.2.1 2000/09/25 23:39:14 itojun Exp $      */
+/*     $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -46,7 +46,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getnameinfo.c,v 1.19 2000/06/12 04:27:58 itojun Exp $");
+__RCSID("$NetBSD: getnameinfo.c,v 1.19.2.1 2000/09/25 23:39:14 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -165,12 +165,12 @@
                                (flags & NI_DGRAM) ? "udp" : "tcp");
                }
                if (sp) {
-                       if (strlen(sp->s_name) > servlen)
+                       if (strlen(sp->s_name) + 1 > servlen)
                                return ENI_MEMORY;
                        strcpy(serv, sp->s_name);
                } else {
                        snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
-                       if (strlen(numserv) > servlen)
+                       if (strlen(numserv) + 1 > servlen)
                                return ENI_MEMORY;
                        strcpy(serv, numserv);
                }
@@ -265,7 +265,7 @@
                                        *p = '\0';
                        }
 #endif
-                       if (strlen(hp->h_name) > hostlen) {
+                       if (strlen(hp->h_name) + 1 > hostlen) {
                                return ENI_MEMORY;
                        }
                        strcpy(host, hp->h_name);



Home | Main Index | Thread Index | Old Index