fixed potentially disastrous bug that could crash the program
authorHolger Schemel <info@artsoft.org>
Tue, 27 Jun 2017 20:40:25 +0000 (22:40 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 27 Jun 2017 20:40:25 +0000 (22:40 +0200)
src/screens.c

index 3703935..dbbd507 100644 (file)
@@ -4146,9 +4146,9 @@ void DrawChooseLevelNr()
                 LevelStats_getSolved(i) ? FC_GREEN :
                 LevelStats_getPlayed(i) ? FC_YELLOW : FC_RED);
 
                 LevelStats_getSolved(i) ? FC_GREEN :
                 LevelStats_getPlayed(i) ? FC_YELLOW : FC_RED);
 
-    sprintf(identifier, "%d", value);
-    sprintf(name, "%03d: %s", value,
-           (level.no_level_file ? "(no file)" : level.name));
+    snprintf(identifier, sizeof(identifier), "%d", value);
+    snprintf(name, sizeof(name), "%03d: %s", value,
+            (level.no_level_file ? "(no file)" : level.name));
 
     setString(&ti->identifier, identifier);
     setString(&ti->name, name);
 
     setString(&ti->identifier, identifier);
     setString(&ti->name, name);