]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/make_hash.c
ncurses 6.1 - patch 20190728
[ncurses.git] / ncurses / tinfo / make_hash.c
index 09748ee3e1cedcffb93124070b9b3c22adffdedc..d5f941825a907f85d9d015f554c2944d9b5efc3d 100644 (file)
@@ -43,7 +43,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: make_hash.c,v 1.27 2019/07/20 20:14:46 tom Exp $")
+MODULE_ID("$Id: make_hash.c,v 1.28 2019/07/27 23:06:54 tom Exp $")
 
 /*
  *     _nc_make_hash_table()
@@ -220,11 +220,17 @@ parse_columns(char *buffer)
 static char *
 get_type(int type_mask)
 {
-    static char result[40];
+    static char result[80];
     unsigned n;
     _nc_STRCPY(result, L_PAREN, sizeof(result));
     for (n = 0; n < 3; ++n) {
        if ((1 << n) & type_mask) {
+           size_t want = 5 + strlen(typenames[n]);
+           if (want > sizeof(result)) {
+               fprintf(stderr, "Buffer is not large enough for %s + %s\n",
+                       result, typenames[n]);
+               exit(EXIT_FAILURE);
+           }
            if (result[1])
                _nc_STRCAT(result, "|", sizeof(result));
            _nc_STRCAT(result, "1<<", sizeof(result));