diff --git a/rtracker.c b/rtracker.c index 19e9f49..5f102e7 100644 --- a/rtracker.c +++ b/rtracker.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include "c_cross_pack/libs/threads.h" @@ -15,8 +14,10 @@ char comment[1000] = ""; char command[10000] = ""; +#define OUT_LEN 1000 // 1000 items with 100 symbol len +int out_len = OUT_LEN; // Output of command execution -char out[1000][100]; +char out[OUT_LEN][100]; int out_i = 0; bool runCommand(char* command) { @@ -40,7 +41,7 @@ bool runCommand(char* command) { strncpy(out[out_i], path, 100); out[out_i][99] = '\0'; // Ensure null termination out_i++; - if (out_i >= 1000) { + if (out_i >= out_len) { break; // Prevent overflow } }