Fix possible string overrun/overcopy situation.

This commit is contained in:
Bill King
2010-06-11 13:38:38 +10:00
parent d074a0bfcc
commit 1a89786979
2 changed files with 6 additions and 3 deletions

View File

@@ -148,7 +148,8 @@ int main()
fseek(envFd, 0, SEEK_END);
size = ftell(envFd);
rewind(envFd);
env = malloc(size);
env = malloc(size + sizeof(wchar_t));
env[size] = 0;
if (fread(env, 1, size, envFd) != size) {
perror("Failed to read env file");
doExit(1);