Skip to content

Commit 9474c44

Browse files
committed
[emscripten] Only import environment array if non-null.
This prevents reading arbitrary memory contents as an environment array.
1 parent a356015 commit 9474c44

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

engine/src/em-main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ platform_main(int argc, char *argv[], char *envp[])
9191
/* ---------- Process the environment */
9292
/* Count env variables */
9393
int t_envc;
94-
for (t_envc = 0; envp[t_envc] != nil; ++t_envc);
94+
for (t_envc = 0; envp != nil && envp[t_envc] != nil; ++t_envc);
9595

9696
/* Import. Note that the envp array is null-terminated */
9797
MCStringRef *t_envp;

0 commit comments

Comments
 (0)