summaryrefslogtreecommitdiff
path: root/graphics.c
diff options
context:
space:
mode:
Diffstat (limited to 'graphics.c')
-rw-r--r--graphics.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/graphics.c b/graphics.c
index be2090d..ecae2a8 100644
--- a/graphics.c
+++ b/graphics.c
@@ -81,7 +81,7 @@ void graphics_init()
{
/* Revert to default */
getfilename("graphics", directory, 0, LOCATION_SYSTEM);
- sprintf(filename, "%s%s%s", directory, "/", GRAPHICS_DEFAULT);
+ snprintf(filename, sizeof(filename), "%s%s%s", directory, "/", GRAPHICS_DEFAULT);
pdisplaygraphics = graphics_load(filename, 0);
/* If we can't even load the default, use a curses based scheme */
@@ -383,7 +383,7 @@ struct menu* graphics_menu()
if(strcmp(dentry->d_name, "..") == 0)
continue;
- sprintf(filename, "%s%s%s", directory, "/", dentry->d_name);
+ snprintf(filename, sizeof(filename), "%s%s%s", directory, "/", dentry->d_name);
if(isfile(filename) && strlen(filename) > 7 && strcmp(filename + strlen(filename) - 7, ".chroma") == 0)
{
@@ -424,7 +424,8 @@ SDL_Surface *graphics_loadimage(char *filename)
char directory[FILENAME_MAX];
getfilename("graphics", directory, 0, LOCATION_SYSTEM);
- sprintf(fullfilename, "%s%s%s", directory, "/", filename);
+ snprintf(fullfilename, sizeof(fullfilename), "%s%s%s",
+ directory, "/", filename);
return IMG_Load(fullfilename);
}
@@ -1327,9 +1328,9 @@ struct graphics* graphics_load(char *filename, int partial)
{
/* Construct pathname */
if(strcmp(path, "") == 0)
- sprintf(file, "%s/", basepath);
+ snprintf(file, sizeof(file), "%s/", basepath);
else
- sprintf(file, "%s/%s/", basepath, path);
+ snprintf(file, sizeof(file), "%s/%s/", basepath, path);
/* Substitute %s as necessary */
j = strlen(file);