]> granicus.if.org Git - graphviz/commitdiff
fix a -Wformat-overflow warning with GCC 8.3
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 May 2020 00:16:36 +0000 (17:16 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 May 2020 00:16:36 +0000 (17:16 -0700)
cmd/gvmap/make_map.c

index f085265ae23b77e9719735c56cc0e510bd06e443..7dfa4b74c9ebaa384e14f4e1124988f89d938705 100644 (file)
@@ -652,16 +652,16 @@ static void dot_polygon(char **sbuff, int *len, int *len_max, int np, float *xp,
   if (np > 0){
     /* figure out the size needed */
     if (fill >= 0){/* poly*/
-      ret += sprintf(buf, " c %d -%s C %d -%s P %d ",(int) strlen(cstring), cstring, (int) strlen(cstring), cstring, np);
+      ret += snprintf(buf, sizeof(buf), " c %d -%s C %d -%s P %d ",(int) strlen(cstring), cstring, (int) strlen(cstring), cstring, np);
     } else {/* line*/
       assert(line_width >= 0);
       if (line_width > 0){
        sprintf(swidth,"%f",line_width);
        len_swidth = strlen(swidth);
        sprintf(swidth,"S %d -setlinewidth(%f)",len_swidth+14, line_width);
-       ret += sprintf(buf, " c %d -%s %s L %d ",(int) strlen(cstring), cstring, swidth, np);
+       ret += snprintf(buf, sizeof(buf), " c %d -%s %s L %d ",(int) strlen(cstring), cstring, swidth, np);
       } else {
-       ret += sprintf(buf, " c %d -%s L %d ",(int) strlen(cstring), cstring, np);
+       ret += snprintf(buf, sizeof(buf), " c %d -%s L %d ",(int) strlen(cstring), cstring, np);
       }
     }
     for (i = 0; i < np; i++){