mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Output error messages for command line includes
The code that adds an include path to the array of paths doesn't check the lenght of the path (which can cause overflows because of strcpy). It doesn't check if the max number of paths has been reached, either. This patch adds error messages for such cases, giving the user more information than before and crashing the assembly instead of continuing and failing when it can't find a file to include.
This commit is contained in:
@@ -179,6 +179,16 @@ fstk_Dump(void)
|
||||
void
|
||||
fstk_AddIncludePath(char *s)
|
||||
{
|
||||
if (NextIncPath == MAXINCPATHS) {
|
||||
fatalerror("Too many include directories passed from command line");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(s) > _MAX_PATH) {
|
||||
fatalerror("Include path too long '%s'",s);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(IncludePaths[NextIncPath++], s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user