mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-03-05 09:57:06 +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(archive_found)
|
||||
{
|
||||
/* FIXME - should use fill_pathname_relative helper function here
|
||||
* to avoid errors. */
|
||||
char rel_path[PATH_MAX];
|
||||
snprintf(rel_path, sizeof(rel_path),
|
||||
"%s", archive_found + strlen(g_extern.carchive_path) + 1);
|
||||
ret = read_compressed_file(g_extern.carchive_path,
|
||||
rel_path, (void**)&ret_buf);
|
||||
}
|
||||
if(archive_found)
|
||||
{
|
||||
if (strlen(path) < strlen(g_extern.carchive_path)+2)
|
||||
{
|
||||
/*
|
||||
* This error condition happens for example, when
|
||||
* carchive_path == path, or
|
||||
* carchive_path + '/' == path.
|
||||
*/
|
||||
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
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user