unix.c
changeset 3287 720ed37be8c6
parent 3280 524352fbb229
child 3294 be3b1e6b4b74
--- a/unix.c	Tue Mar 21 22:06:32 2006 +0000
+++ b/unix.c	Tue Mar 21 22:08:15 2006 +0000
@@ -362,7 +362,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;
@@ -376,14 +376,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;
 }