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/stdio Pull up revisions 1.14-1.15 (requested b...



details:   https://anonhg.NetBSD.org/src/rev/ac43fe258976
branches:  netbsd-1-5
changeset: 489929:ac43fe258976
user:      he <he%NetBSD.org@localhost>
date:      Thu Oct 19 14:05:25 2000 +0000

description:
Pull up revisions 1.14-1.15 (requested by kleink):
  C99 alignment: a buffer size of 0 is permitted.  Also, when
  size is 0, a null buffer pointer may be passed.  Fixes PR#9603.

diffstat:

 lib/libc/stdio/vsnprintf.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 47e55f6aa22a -r ac43fe258976 lib/libc/stdio/vsnprintf.c
--- a/lib/libc/stdio/vsnprintf.c        Thu Oct 19 14:04:52 2000 +0000
+++ b/lib/libc/stdio/vsnprintf.c        Thu Oct 19 14:05:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vsnprintf.c,v 1.13 2000/01/22 22:19:19 mycroft Exp $   */
+/*     $NetBSD: vsnprintf.c,v 1.13.4.1 2000/10/19 14:05:25 he Exp $    */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)vsnprintf.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: vsnprintf.c,v 1.13 2000/01/22 22:19:19 mycroft Exp $");
+__RCSID("$NetBSD: vsnprintf.c,v 1.13.4.1 2000/10/19 14:05:25 he Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -65,11 +65,14 @@
        int ret;
        FILE f;
 
-       _DIAGASSERT(str != NULL);
+       _DIAGASSERT(n == 0 || str != NULL);
        _DIAGASSERT(fmt != NULL);
 
-       if ((int)n < 1)
+       if ((int)n < 0) {
+               errno = EINVAL;
                return (-1);
+       }
+
        f._file = -1;
        f._flags = __SWR | __SSTR;
        f._bf._base = f._p = (unsigned char *)str;



Home | Main Index | Thread Index | Old Index