Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net Leave room for the null terminator. Spotted by ...



details:   https://anonhg.NetBSD.org/src/rev/0476a97c5bf8
branches:  trunk
changeset: 349327:0476a97c5bf8
user:      dholland <dholland%NetBSD.org@localhost>
date:      Wed Dec 07 02:36:41 2016 +0000

description:
Leave room for the null terminator. Spotted by DuClare on freenode.

diffstat:

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

diffs (27 lines):

diff -r 6b3ea39fef9f -r 0476a97c5bf8 lib/libc/net/linkaddr.c
--- a/lib/libc/net/linkaddr.c   Tue Dec 06 18:59:00 2016 +0000
+++ b/lib/libc/net/linkaddr.c   Wed Dec 07 02:36:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linkaddr.c,v 1.17 2016/12/06 18:41:02 christos Exp $   */
+/*     $NetBSD: linkaddr.c,v 1.18 2016/12/07 02:36:41 dholland Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: linkaddr.c,v 1.17 2016/12/06 18:41:02 christos Exp $");
+__RCSID("$NetBSD: linkaddr.c,v 1.18 2016/12/07 02:36:41 dholland Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -148,7 +148,7 @@
 
 #define ADDC(ch) \
        do { \
-               if (out >= obuf + sizeof(obuf)) \
+               if (out >= obuf + sizeof(obuf) - 1) \
                        return NULL; \
                *out++ = (ch); \
        } while (/*CONSTCOND*/0)



Home | Main Index | Thread Index | Old Index