Module Name: src
Committed By: riz
Date: Thu Mar 14 19:07:31 UTC 2013
Modified Files:
src/lib/libterminfo [netbsd-6]: tparm.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.7.4.3 -r1.7.4.4 src/lib/libterminfo/tparm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libterminfo/tparm.c
diff -u src/lib/libterminfo/tparm.c:1.7.4.3 src/lib/libterminfo/tparm.c:1.7.4.4
--- src/lib/libterminfo/tparm.c:1.7.4.3 Thu Mar 14 15:48:29 2013
+++ src/lib/libterminfo/tparm.c Thu Mar 14 19:07:30 2013
@@ -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 @@ checkbuf(TERMINAL *term, size_t len)
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;
}