1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Description: fixing possible buffer overflow in fgetws
sizeof(buf) is 1024, but sizeof(wchar_t) is 4,
so there is just space for sizeof(buf)/sizeof(wchar_t) - 256 chars in buffer.
.
/*
CC="gcc -D_FORTIFY_SOURCE=2 -O2" make
...
call to ‘__fgetws_chk_warn’ declared with attribute warning: \
fgetws called with bigger size than length of destination buffer
*/
Forwarded: https://github.com/kilobyte/braillefont/commit/1cdb4c1f4a14a4f16a345592323303f1c07b9176
Last-Update: 2020-12-03
---
--- braillefont-1.0.orig/braillefont.c
+++ braillefont-1.0/braillefont.c
@@ -52,7 +52,7 @@ int main()
wchar_t buf[1024];
setlocale(LC_CTYPE, "");
- while (fgetws(buf, sizeof(buf), stdin))
+ while (fgetws(buf, sizeof(buf)/sizeof(wchar_t), stdin))
{
const wchar_t *b;
for (b=buf; *b; b++)
|