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.12 (requested by itojun...



details:   https://anonhg.NetBSD.org/src/rev/fe6d6f195d7f
branches:  netbsd-1-6
changeset: 529040:fe6d6f195d7f
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Aug 27 09:27:47 2002 +0000

description:
Pull up revision 1.12 (requested by itojun in ticket #721):
off-by-one.  PR 18049
correct snprintf() return value handling in another place.

diffstat:

 lib/libc/net/inet_ntop.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r e6f3dbed59a8 -r fe6d6f195d7f lib/libc/net/inet_ntop.c
--- a/lib/libc/net/inet_ntop.c  Tue Aug 27 09:25:43 2002 +0000
+++ b/lib/libc/net/inet_ntop.c  Tue Aug 27 09:27:47 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet_ntop.c,v 1.10.2.1 2002/08/27 09:25:43 lukem Exp $ */
+/*     $NetBSD: inet_ntop.c,v 1.10.2.2 2002/08/27 09:27:47 lukem Exp $ */
 
 /* Copyright (c) 1996 by Internet Software Consortium.
  *
@@ -21,7 +21,7 @@
 #if 0
 static char rcsid[] = "Id: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp ";
 #else
-__RCSID("$NetBSD: inet_ntop.c,v 1.10.2.1 2002/08/27 09:25:43 lukem Exp $");
+__RCSID("$NetBSD: inet_ntop.c,v 1.10.2.2 2002/08/27 09:27:47 lukem Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -109,7 +109,7 @@
 
        l = snprintf(tmp, sizeof(tmp), "%u.%u.%u.%u",
            src[0], src[1], src[2], src[3]);
-       if (l <= 0 || l > size) {
+       if (l <= 0 || l >= size) {
                errno = ENOSPC;
                return (NULL);
        }
@@ -205,7 +205,7 @@
                        break;
                }
                advance = snprintf(tp, (size_t)(ep - tp), "%x", words[i]);
-               if (advance <= 0)
+               if (advance <= 0 || advance >= ep - tp)
                        return (NULL);
                tp += advance;
        }



Home | Main Index | Thread Index | Old Index