[CRT] Use sprintf_s instead of sprintf

Fixes GCC 8 warning:
sdk/lib/crt/misc/i10output.c:83:25: error: '%d' directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
     sprintf(format, "%%.%dle", prec);
                         ^~
sdk/lib/crt/misc/i10output.c:83:21: note: directive argument in the range [-2147483648, 2147483646]
     sprintf(format, "%%.%dle", prec);
                     ^~~~~~~~~
sdk/lib/crt/misc/i10output.c:83:5: note: 'sprintf' output between 6 and 16 bytes into a destination of size 8
     sprintf(format, "%%.%dle", prec);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 18:27:22 +02:00
parent b275f24406
commit 95b3eebf71

View file

@ -80,8 +80,8 @@ int CDECL MSVCRT_I10_OUTPUT(_LDOUBLE ld80, int prec, int flag, struct _I10_OUTPU
prec = 0;
}
sprintf(format, "%%.%dle", prec);
sprintf(buf, format, d);
sprintf_s(format, sizeof(format), "%%.%dle", prec);
sprintf_s(buf, sizeof(buf), format, d);
buf[1] = buf[0];
data->pos = atoi(buf+prec+3);