Skip to content
Permalink
Browse files

Fix really annoying case of uninitialized memory that results in file…

…s with garbage names at odd places.
  • Loading branch information...
Alcaro committed Jan 6, 2014
1 parent e538d85 commit 45cca183836f5f69919586fa4716c2eba591762e
Showing with 8 additions and 2 deletions.
  1. +8 −2 fceumm-code/src/general.c
@@ -67,22 +67,27 @@ void FCEUI_SetDirOverride(int which, char *n) {
}

#ifndef HAVE_ASPRINTF
#ifndef __LIBRETRO__
static int asprintf(char **strp, const char *fmt, ...) {
va_list ap;
int ret;

va_start(ap, fmt);
if (!(*strp = malloc(2048)))
return(0);
#ifndef __LIBRETRO__
ret = vsnprintf(*strp, 2048, fmt, ap);
#endif
va_end(ap);
return(ret);
}
#endif
#endif

char *FCEU_MakeFName(int type, int id1, char *cd1) {
#ifdef __LIBRETRO__
char* ret=malloc(1);
*ret='\0';
return ret;
#else
char *ret = 0;
struct stat tmpstat;

@@ -165,6 +170,7 @@ char *FCEU_MakeFName(int type, int id1, char *cd1) {
break;
}
return(ret);
#endif
}

void GetFileBase(const char *f) {

0 comments on commit 45cca18

Please sign in to comment.
You can’t perform that action at this time.