diff options
author | hizzlekizzle | 2019-02-05 11:50:43 -0600 |
---|---|---|
committer | GitHub | 2019-02-05 11:50:43 -0600 |
commit | 907278f8f037086a04f9407717885f01f9f49f2b (patch) | |
tree | 036280f73023b8ad42b1a79ae210efcbce3f2ea6 | |
parent | 46486658dc234b657802a44ce99c99a9cb7ddcaa (diff) | |
parent | 6f4557bf81c4d12d3a7aaf2b75a355e380a51490 (diff) | |
download | pcsx_rearmed-907278f8f037086a04f9407717885f01f9f49f2b.tar.gz pcsx_rearmed-907278f8f037086a04f9407717885f01f9f49f2b.tar.bz2 pcsx_rearmed-907278f8f037086a04f9407717885f01f9f49f2b.zip |
Merge pull request #217 from orbea/cue
Fix segfault when loading cue files from relative paths.
-rw-r--r-- | libpcsxcore/cdriso.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 169c945..cf1a59e 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -565,20 +565,15 @@ static int parsecue(const char *isofile) { if (t != 1) sscanf(linebuf, " FILE %255s", tmpb); - // absolute path? - ti[numtracks + 1].handle = fopen(tmpb, "rb"); - if (ti[numtracks + 1].handle == NULL) { - // relative to .cue? - tmp = strrchr(tmpb, '\\'); - if (tmp == NULL) - tmp = strrchr(tmpb, '/'); - if (tmp != NULL) - tmp++; - else - tmp = tmpb; - strncpy(incue_fname, tmp, incue_max_len); - ti[numtracks + 1].handle = fopen(filepath, "rb"); - } + tmp = strrchr(tmpb, '\\'); + if (tmp == NULL) + tmp = strrchr(tmpb, '/'); + if (tmp != NULL) + tmp++; + else + tmp = tmpb; + strncpy(incue_fname, tmp, incue_max_len); + ti[numtracks + 1].handle = fopen(filepath, "rb"); // update global offset if this is not first file in this .cue if (numtracks + 1 > 1) { |