Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Make sure tspace is large enough to hold all c...



details:   https://anonhg.NetBSD.org/src/rev/8b0b412c6f8c
branches:  trunk
changeset: 487770:8b0b412c6f8c
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Jun 12 20:48:34 2000 +0000

description:
Make sure tspace is large enough to hold all capabilities.

diffstat:

 lib/libcurses/setterm.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 5ec992748170 -r 8b0b412c6f8c lib/libcurses/setterm.c
--- a/lib/libcurses/setterm.c   Mon Jun 12 20:13:41 2000 +0000
+++ b/lib/libcurses/setterm.c   Mon Jun 12 20:48:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setterm.c,v 1.24 2000/06/03 06:33:12 blymn Exp $       */
+/*     $NetBSD: setterm.c,v 1.25 2000/06/12 20:48:34 jdc Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)setterm.c  8.8 (Berkeley) 10/25/94";
 #else
-__RCSID("$NetBSD: setterm.c,v 1.24 2000/06/03 06:33:12 blymn Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.25 2000/06/12 20:48:34 jdc Exp $");
 #endif
 #endif /* not lint */
 
@@ -285,7 +285,7 @@
                *tmp = *namp;
                *(tmp + 1) = *(namp + 1);
                t_getstr(tinfo, tmp, NULL, &i);
-               tspace_size += i;
+               tspace_size += i + 1;
                namp += 2;
        } while (*namp);
 
@@ -340,11 +340,12 @@
        char *new_tspace;
 
          /* verify cap exists and grab size of it at the same time */
-       t_getstr(_cursesi_genbuf, name, NULL, &ent_size);
+       if (t_getstr(_cursesi_genbuf, name, NULL, &ent_size) == ERR)
+               return ERR;
 
          /* grow tspace to hold the new cap */
        if ((new_tspace = realloc(tspace, ent_size + tspace_size)) == NULL)
-               return NULL;
+               return ERR;
 
          /* point aoftspace to the same place in the newly allocated buffer */
        offset = aoftspace - tspace;



Home | Main Index | Thread Index | Old Index