From 208177a7ea246a6e26222500da945a414b292b57 Mon Sep 17 00:00:00 2001 From: retro-wertz Date: Fri, 2 Aug 2019 20:55:20 +0800 Subject: [PATCH] Sanitize Loaded CD image string in log --- libpcsxcore/cdriso.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 975105ed..daed921e 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -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(); -- 2.39.2