Sanitize Loaded CD image string in log
authorretro-wertz <retro-wertz@users.noreply.github.com>
Fri, 2 Aug 2019 12:55:20 +0000 (20:55 +0800)
committerretro-wertz <retro-wertz@users.noreply.github.com>
Fri, 2 Aug 2019 12:55:20 +0000 (20:55 +0800)
libpcsxcore/cdriso.c

index 975105e..daed921 100644 (file)
@@ -1349,6 +1349,7 @@ static long CALLBACK ISOopen(void) {
        boolean isMode1ISO = FALSE;
        char alt_bin_filename[MAXPATHLEN];
        const char *bin_filename;
+       char image_str[1024] = {0};
 
        if (cdHandle != NULL) {
                return 0; // it's already open
@@ -1361,7 +1362,7 @@ static long CALLBACK ISOopen(void) {
                return -1;
        }
 
-       SysPrintf(_("Loaded CD Image: %s"), GetIsoFile());
+       sprintf(image_str, "Loaded CD Image: %s", GetIsoFile());
 
        cddaBigEndian = FALSE;
        subChanMixed = FALSE;
@@ -1374,40 +1375,40 @@ static long CALLBACK ISOopen(void) {
        cdimg_read_func = cdread_normal;
 
        if (parsetoc(GetIsoFile()) == 0) {
-               SysPrintf("[+toc]");
+               strcat(image_str, "[+toc]");
        }
        else if (parseccd(GetIsoFile()) == 0) {
-               SysPrintf("[+ccd]");
+               strcat(image_str, "[+ccd]");
        }
        else if (parsemds(GetIsoFile()) == 0) {
-               SysPrintf("[+mds]");
+               strcat(image_str, "[+mds]");
        }
        else if (parsecue(GetIsoFile()) == 0) {
-               SysPrintf("[+cue]");
+               strcat(image_str, "[+cue]");
        }
        if (handlepbp(GetIsoFile()) == 0) {
-               SysPrintf("[pbp]");
+               strcat(image_str, "[+pbp]");
                CDR_getBuffer = ISOgetBuffer_compr;
                cdimg_read_func = cdread_compressed;
        }
        else if (handlecbin(GetIsoFile()) == 0) {
-               SysPrintf("[cbin]");
+               strcat(image_str, "[+cbin]");
                CDR_getBuffer = ISOgetBuffer_compr;
                cdimg_read_func = cdread_compressed;
        }
 #ifdef HAVE_CHD
        else if (handlechd(GetIsoFile()) == 0) {
-               SysPrintf("[chd]");
+               strcat(image_str, "[+chd]");
                CDR_getBuffer = ISOgetBuffer_chd;
                cdimg_read_func = cdread_chd;
        }
 #endif
 
        if (!subChanMixed && opensubfile(GetIsoFile()) == 0) {
-               SysPrintf("[+sub]");
+               strcat(image_str, "[+sub]");
        }
        if (opensbifile(GetIsoFile()) == 0) {
-               SysPrintf("[+sbi]");
+               strcat(image_str, "[+sbi]");
        }
 
        fseeko(cdHandle, 0, SEEK_END);
@@ -1445,13 +1446,13 @@ static long CALLBACK ISOopen(void) {
                fseek(cdHandle, 0, SEEK_SET);
                fread(&modeTest, 4, 1, cdHandle);
                if (SWAP32(modeTest) != 0xffffff00) {
-                       SysPrintf("[2048]");
+                       strcat(image_str, "[2048]");
                        isMode1ISO = TRUE;
                }
        }
        fseek(cdHandle, 0, SEEK_SET);
 
-       SysPrintf(".\n");
+       SysPrintf("%s.\n", image_str);
 
        PrintTracks();