unix.c
branch0.4.5
changeset 9948 877dccfeb22e
parent 2940 ce57a148333e
child 9956 341e963c63c4
--- a/unix.c	Wed Mar 22 11:24:27 2006 +0000
+++ b/unix.c	Wed Mar 22 11:26:08 2006 +0000
@@ -361,7 +361,7 @@
 	return STR_4005_BYTES_FREE;
 }
 
-void FiosMakeSavegameName(char *buf, const char *name)
+void FiosMakeSavegameName(char *buf, const char *name, size_t size)
 {
 	const char* extension;
 	const char* period;
@@ -375,14 +375,14 @@
 	period = strrchr(name, '.');
 	if (period != NULL && strcasecmp(period, extension) == 0) extension = "";
 
-	sprintf(buf, "%s/%s%s", _fios_path, name, extension);
+	snprintf(buf, size, "%s/%s%s", _fios_path, name, extension);
 }
 
 bool FiosDelete(const char *name)
 {
 	char path[512];
 
-	snprintf(path, lengthof(path), "%s/%s", _fios_path, name);
+	FiosMakeSavegameName(path, name, sizeof(path));
 	return unlink(path) == 0;
 }