Cleanup FCEU_MakeFName

- silence warnings: replace strncpy with strcpy instead. this should be safe since buffer is strlen+1 which should be enough for a null terminator (from sprintf)
- minor cleanup
This commit is contained in:
negativeExponent
2020-01-27 21:31:54 +08:00
parent e1e48294f0
commit 3f756dc7fc
2 changed files with 10 additions and 13 deletions

View File

@@ -90,8 +90,10 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
break;
}
FCEU_printf(" FCEU_MakeFName: %s\n", tmp);
ret = (char*)malloc(strlen(tmp) * sizeof(char) + 1);
strncpy(ret, tmp, strlen(tmp) + 1);
strcpy(ret, tmp);
return(ret);
}