cctsao1008 / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

line 27 in platform/platform_unix.c (Buf[MaxLen] = '\0') #180

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Isn't line 27 in platform/platform_unix.c a small bug (buffer overrun by 1)?

        Buf[MaxLen] = '\0';

In other words if MaxLen is the maximum length of the buffer, writing '\0' at 
position MaxLen is one past the end of the buffer.

Compiling picoc on OS X with this line generates "Abort trap" when picoc is 
launched in interactive mode.

Removing this line altogether and recompiling picoc solved the problem for me. 
I don't think this line is even necessary since the next line is strncpy(Buf, 
InLine, MaxLen-1).

Original issue reported on code.google.com by n...@d-type.com on 8 Apr 2013 at 4:30

GoogleCodeExporter commented 9 years ago
Fix added in r602

Original comment by zik.sale...@gmail.com on 14 Oct 2013 at 11:38