defWrite.: '%.10g' directive writing between 1 and 17 bytes into a region of size 12

GCC14 loud default warnings series [-Wformat-overflow=]
This commit is contained in:
Darryl L. Miles 2024-10-02 06:59:00 +01:00 committed by Tim Edwards
parent 9f88450243
commit 6a08b31149
1 changed files with 2 additions and 2 deletions

View File

@ -531,7 +531,7 @@ defWriteRouteWidth(defdata, width)
int width; int width;
{ {
float oscale = defdata->scale; float oscale = defdata->scale;
char numstr[12]; char numstr[32];
sprintf(numstr, "%.10g", ((float)width * defdata->scale)); sprintf(numstr, "%.10g", ((float)width * defdata->scale));
defCheckForBreak(strlen(numstr) + 1, defdata); defCheckForBreak(strlen(numstr) + 1, defdata);
fprintf(defdata->f, "%s ", numstr); fprintf(defdata->f, "%s ", numstr);
@ -564,7 +564,7 @@ defWriteCoord(defdata, x, y, orient)
unsigned char orient; unsigned char orient;
{ {
FILE *f = defdata->f; FILE *f = defdata->f;
char numstr[12]; char numstr[32];
int ctot = 4; int ctot = 4;
/* The "12" here is just a fudge factor; it is not crucial */ /* The "12" here is just a fudge factor; it is not crucial */