From: Matthew Fernandez Date: Sat, 9 May 2020 00:16:36 +0000 (-0700) Subject: fix a -Wformat-overflow warning with GCC 8.3 X-Git-Tag: 2.44.1~72^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8969b213d4426989e21a39938c0b45e2be4062f8;p=graphviz fix a -Wformat-overflow warning with GCC 8.3 --- diff --git a/cmd/gvmap/make_map.c b/cmd/gvmap/make_map.c index f085265ae..7dfa4b74c 100644 --- a/cmd/gvmap/make_map.c +++ b/cmd/gvmap/make_map.c @@ -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++){