Source-Changes-HG archive

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

[src/netbsd-6]: src/lib/libterminfo Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/e448551dfa1d
branches:  netbsd-6
changeset: 775724:e448551dfa1d
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Mar 14 19:07:30 2013 +0000

description:
Pull up following revision(s) (requested by roy in ticket #835):
        lib/libterminfo/tparm.c: revision 1.8
Ensure that we request a buffer big enough, although with the current
terminfo specification this should never happen.
Correctly return NULL when realloc(3) fails.

diffstat:

 lib/libterminfo/tparm.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 884f91a68e2b -r e448551dfa1d lib/libterminfo/tparm.c
--- a/lib/libterminfo/tparm.c   Thu Mar 14 16:33:57 2013 +0000
+++ b/lib/libterminfo/tparm.c   Thu Mar 14 19:07:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tparm.c,v 1.7.4.3 2013/03/14 15:48:29 riz Exp $ */
+/* $NetBSD: tparm.c,v 1.7.4.4 2013/03/14 19:07:30 riz Exp $ */
 
 /*
  * Copyright (c) 2009, 2011, 2013 The NetBSD Foundation, Inc.
@@ -28,7 +28,8 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tparm.c,v 1.7.4.3 2013/03/14 15:48:29 riz Exp $");
+__RCSID("$NetBSD: tparm.c,v 1.7.4.4 2013/03/14 19:07:30 riz Exp $");
+#include <sys/param.h>
 
 #include <assert.h>
 #include <ctype.h>
@@ -98,10 +99,10 @@
        char *buf;
        
        if (term->_bufpos + len >= term->_buflen) {
-               len = term->_buflen + BUFSIZ;
+               len = term->_buflen + MAX(len, BUFSIZ);
                buf = realloc(term->_buf, len);
                if (buf == NULL)
-                       return 0;
+                       return NULL;
                term->_buf = buf;
                term->_buflen = len;
        }



Home | Main Index | Thread Index | Old Index