···13021302 *tmpCommonPrefix = 0;
13031303 }
1304130413051305+ // Calculate remaining buffer space
13061306+ size_t currentLength = strlen(data->options);
13071307+ // ASAN GIVE IT TWICE THE CONSOLE_BUFFER_SCREEN FOR FUNSIES
13081308+ size_t availableSpace = (CONSOLE_BUFFER_SCREEN * 2) - currentLength - 1; // -1 for null terminator
13091309+13101310+ if (strlen(option) + 1 > availableSpace) { // +1 for the space character
13111311+ printf("ASAN Error: Not enough buffer space to add option: %s\n", option);
13121312+ return; // Early return to prevent buffer overflow
13131313+ }
13141314+13151315+ // Debugging information
13161316+ printf("ASAN Buffer space before adding: %zu\n", availableSpace);
13171317+13051318 // The option matches the incomplete word, add it to the list.
13061306- printf("Buffer size before adding option: %zu\n", strlen(data->options));
13071307- printf("Adding option: %s\n", option);
13081308- strncat(data->options, option, CONSOLE_BUFFER_SCREEN);
13091309- strncat(data->options, " ", CONSOLE_BUFFER_SCREEN);
13101310- printf("Buffer size after adding option: %zu\n", strlen(data->options));
13191319+ strncat(data->options, option, availableSpace);
13201320+ strncat(data->options, " ", availableSpace - strlen(option));
13211321+13221322+ // Debugging information
13231323+ printf("ASAN Option added successfully: %s\n", option);
13241324+13251325+ // The option matches the incomplete word, add it to the list.
13261326+ // alice was here
13271327+ // ASAN TELLS ME THIS IS THE ISSUE
13281328+ // strncat(data->options, option, CONSOLE_BUFFER_SCREEN);
13291329+ // strncat(data->options, " ", CONSOLE_BUFFER_SCREEN);
13111330 }
13121331}
13321332+1313133313141334// Used to show tab-complete options, for example.
13151335static void provideHint(Console* console, const char* hint)