]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/picsmap.c
ncurses 6.2 - patch 20210327
[ncurses.git] / test / picsmap.c
index 3c4eb697a4de710a91be75b4e3aa3732bff09dbb..1aaa5af9d45d6152496ad48a467ca946332056d4 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
  * Copyright 2017,2018 Free Software Foundation, Inc.                       *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -27,7 +27,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: picsmap.c,v 1.134 2020/07/11 23:01:49 tom Exp $
+ * $Id: picsmap.c,v 1.137 2021/03/27 22:52:16 tom Exp $
  *
  * Author: Thomas E. Dickey
  *
@@ -109,7 +109,7 @@ typedef struct {
 #define debugmsg if (debugging) logmsg
 #define debugmsg2 if (debugging) logmsg2
 
-static void cleanup(int) GCC_NORETURN;
+static GCC_NORETURN void cleanup(int);
 static void giveup(const char *fmt, ...) GCC_PRINTFLIKE(1, 2);
 static void logmsg(const char *fmt, ...) GCC_PRINTFLIKE(1, 2);
 static void logmsg2(const char *fmt, ...) GCC_PRINTFLIKE(1, 2);
@@ -1015,7 +1015,7 @@ parse_xbm(char **data)
        case 0:
        case 1:
        case 2:
-           if (sscanf(s, "#define %s %d%c", buf, &num, &ch) >= 2) {
+           if (sscanf(s, "#define %1024s %d%c", buf, &num, &ch) >= 2) {
                if ((t = strstr(buf, "_width")) != 0) {
                    state |= 1;
                    result->wide = (short) bytes_of(num);
@@ -1036,7 +1036,7 @@ parse_xbm(char **data)
            }
            break;
        case 3:
-           if (sscanf(s, "static char %[^_ ]_bits[]%c", buf, &ch) >= 1) {
+           if (sscanf(s, "static char %1024[^_ ]_bits[]%c", buf, &ch) >= 1) {
                if (strcmp(result->name, buf)) {
                    goto finish;
                }
@@ -1612,7 +1612,7 @@ report_colors(PICS_HEAD * pics)
            for (k = 0; k < wide; ++k) {
                int n = j + (k * high);
                size_t want = (sizeof(buffer) - (size_t) (s - buffer));
-               if (want < 100)
+               if (want < 100 || want >= sizeof(buffer))
                    break;
                if (n >= pics->colors)
                    break;