mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
fixes for memory leaks and out of bounds memory access found by ASAN or gcc -flto
This commit is contained in:
parent
bb70cc6e66
commit
a20300bf1e
8 changed files with 27 additions and 12 deletions
|
@ -71,11 +71,11 @@ static int get_ext(const char *fname, char ext[4],
|
|||
{
|
||||
int len, pos = 0;
|
||||
|
||||
len = strlen(fname);
|
||||
if (len >= 3)
|
||||
pos = len - 3;
|
||||
len = strrchr(fname, '.') - fname;
|
||||
if (len > 0)
|
||||
pos = len;
|
||||
|
||||
strcpy(ext, fname + pos);
|
||||
strcpy(ext, fname + pos + 1);
|
||||
|
||||
if (base != NULL) {
|
||||
if (pos + 1 < base_size)
|
||||
|
@ -153,9 +153,8 @@ cue_data_t *cue_parse(const char *fname)
|
|||
|
||||
// the basename of cuefile, no path
|
||||
snprintf(cue_base, sizeof(cue_base), "%s", current_filep);
|
||||
p = cue_base + strlen(cue_base);
|
||||
if (p - 3 >= cue_base)
|
||||
p[-3] = 0;
|
||||
p = strrchr(cue_base, '.');
|
||||
if (p) p[1] = '\0';
|
||||
|
||||
data = calloc(1, sizeof(*data) + count_alloc * sizeof(cue_track));
|
||||
if (data == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue