1
0
Fork 0

Fix a bug where the interpreter could read a garbage buffer from the stack.

This commit is contained in:
andy 2004-05-15 21:40:58 +00:00
parent c3c61ae657
commit e590737451

View file

@ -195,6 +195,7 @@ static naRef f_print(naContext c, naRef args)
#define BUFLEN 1024 #define BUFLEN 1024
char buf[BUFLEN + 1]; char buf[BUFLEN + 1];
buf[BUFLEN] = 0; // extra nul to handle strncpy brain damage buf[BUFLEN] = 0; // extra nul to handle strncpy brain damage
buf[0] = 0; // Zero-length in case there are no arguments
char* p = buf; char* p = buf;
int buflen = BUFLEN; int buflen = BUFLEN;
int n = naVec_size(args); int n = naVec_size(args);