mirror of
https://github.com/FAUSheppy/colorredstderr-mirror
synced 2025-12-09 16:38:32 +01:00
trackfds.h: Fix invalid write if tracked_fds_count is 0.
Also fixes missing initialization of env array.
This commit is contained in:
@@ -106,7 +106,9 @@ static void update_environment(void) {
|
||||
/* An integer (32-bit) has at most 10 digits, + 1 for the comma after each
|
||||
* number. Bigger file descriptors (which shouldn't occur in reality) are
|
||||
* skipped. */
|
||||
char env[tracked_fds_count * (10 + 1) * sizeof(char)];
|
||||
char env[tracked_fds_count * (10 + 1) + 1 /* to fit '\0' */ ];
|
||||
env[0] = 0;
|
||||
|
||||
char *x = env;
|
||||
|
||||
size_t i;
|
||||
|
||||
Reference in New Issue
Block a user