Re: [9fans] snprintf buffer overrun

2016-11-27 Thread cinap_lenrek
commited fix in 9front, thanks for reporting! -- cinap

Re: [9fans] snprintf buffer overrun

2016-11-27 Thread cinap_lenrek
theres a bug is in sclose() where it doesnt check if wp is beyond the buffer. also wp was not updated after realloc(). --- a/sys/src/libstdio/sclose.c Sat Nov 19 16:47:21 2016 +0100 +++ b/sys/src/libstdio/sclose.c Sun Nov 27 21:07:48 2016 +0100 @@ -5,27 +5,35 @@ char *sclose(FILE *f){ swi

[9fans] snprintf buffer overrun

2016-11-27 Thread Porlock
Plan 9's implementation of the standard C functions snprintf and vsnprintf have a buffer overrun bug. If the buffer length equals the output length (without the terminating null), then one too many characters is written to the buffer. For example, snprintf(buf, 4, "ABCD"); will wri