Fix a bug where the interpreter could read a garbage buffer from the stack.
This commit is contained in:
parent
c3c61ae657
commit
e590737451
1 changed files with 1 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue