mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Removed snprintf and FIXME from file.c. Additional strlen check
This commit is contained in:
parent
38fec68fe9
commit
3615e978ed
33
file.c
33
file.c
@ -151,16 +151,29 @@ static ssize_t read_content_file(const char *path, void **buf)
|
|||||||
|
|
||||||
if (g_extern.is_carchive)
|
if (g_extern.is_carchive)
|
||||||
{
|
{
|
||||||
if(archive_found)
|
if(archive_found)
|
||||||
{
|
{
|
||||||
/* FIXME - should use fill_pathname_relative helper function here
|
if (strlen(path) < strlen(g_extern.carchive_path)+2)
|
||||||
* to avoid errors. */
|
{
|
||||||
char rel_path[PATH_MAX];
|
/*
|
||||||
snprintf(rel_path, sizeof(rel_path),
|
* This error condition happens for example, when
|
||||||
"%s", archive_found + strlen(g_extern.carchive_path) + 1);
|
* carchive_path == path, or
|
||||||
ret = read_compressed_file(g_extern.carchive_path,
|
* carchive_path + '/' == path.
|
||||||
rel_path, (void**)&ret_buf);
|
*/
|
||||||
}
|
RARCH_ERR("Could not extract image path %s from carchive path %s.\n",
|
||||||
|
path, g_extern.carchive_path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ret = read_compressed_file(g_extern.carchive_path,
|
||||||
|
archive_found + strlen(g_extern.carchive_path) + 1, (void**)&ret_buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* If we didn't actually find the archivename in the filename
|
||||||
|
* the given path is not inside the archive. Then we proceed to just load the file.
|
||||||
|
*/
|
||||||
|
ret = read_file(path, (void**)&ret_buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user