[misc] fix various Coverity issues

* update DLL load/unload
* fix resources not being freed and potentially unsafe calls
* add extra checks
This commit is contained in:
Pete Batard 2014-05-09 22:05:25 +01:00
parent 9aa308213d
commit 266599e6fd
12 changed files with 68 additions and 36 deletions

View file

@ -988,7 +988,7 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS)
if ((cp == 437) && (strcmp(kb, "us") == 0)) {
// Nothing much to do if US/US - just notify in autoexec.bat
strcpy(filename, path);
safe_strcpy(filename, sizeof(filename), path);
safe_strcat(filename, sizeof(filename), "\\AUTOEXEC.BAT");
fd = fopen(filename, "w+");
if (fd == NULL) {
@ -1004,7 +1004,7 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS)
}
// CONFIG.SYS
strcpy(filename, path);
safe_strcpy(filename, sizeof(filename), path);
safe_strcat(filename, sizeof(filename), "\\CONFIG.SYS");
fd = fopen(filename, "w+");
if (fd == NULL) {
@ -1029,7 +1029,7 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS)
uprintf("Successfully wrote 'CONFIG.SYS'\n");
// AUTOEXEC.BAT
strcpy(filename, path);
safe_strcpy(filename, sizeof(filename), path);
safe_strcat(filename, sizeof(filename), "\\AUTOEXEC.BAT");
fd = fopen(filename, "w+");
if (fd == NULL) {