this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

re-add asan? something's off

alice 8bccb03a 94d65d47

+25 -5
+25 -5
src/studio/screens/console.c
··· 1302 1302 *tmpCommonPrefix = 0; 1303 1303 } 1304 1304 1305 + // Calculate remaining buffer space 1306 + size_t currentLength = strlen(data->options); 1307 + // ASAN GIVE IT TWICE THE CONSOLE_BUFFER_SCREEN FOR FUNSIES 1308 + size_t availableSpace = (CONSOLE_BUFFER_SCREEN * 2) - currentLength - 1; // -1 for null terminator 1309 + 1310 + if (strlen(option) + 1 > availableSpace) { // +1 for the space character 1311 + printf("ASAN Error: Not enough buffer space to add option: %s\n", option); 1312 + return; // Early return to prevent buffer overflow 1313 + } 1314 + 1315 + // Debugging information 1316 + printf("ASAN Buffer space before adding: %zu\n", availableSpace); 1317 + 1305 1318 // The option matches the incomplete word, add it to the list. 1306 - printf("Buffer size before adding option: %zu\n", strlen(data->options)); 1307 - printf("Adding option: %s\n", option); 1308 - strncat(data->options, option, CONSOLE_BUFFER_SCREEN); 1309 - strncat(data->options, " ", CONSOLE_BUFFER_SCREEN); 1310 - printf("Buffer size after adding option: %zu\n", strlen(data->options)); 1319 + strncat(data->options, option, availableSpace); 1320 + strncat(data->options, " ", availableSpace - strlen(option)); 1321 + 1322 + // Debugging information 1323 + printf("ASAN Option added successfully: %s\n", option); 1324 + 1325 + // The option matches the incomplete word, add it to the list. 1326 + // alice was here 1327 + // ASAN TELLS ME THIS IS THE ISSUE 1328 + // strncat(data->options, option, CONSOLE_BUFFER_SCREEN); 1329 + // strncat(data->options, " ", CONSOLE_BUFFER_SCREEN); 1311 1330 } 1312 1331 } 1332 + 1313 1333 1314 1334 // Used to show tab-complete options, for example. 1315 1335 static void provideHint(Console* console, const char* hint)