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 3703935f523ae5c40c126f2b6c60235574d4c6f6..dbbd50758440729770eec943d72452c5529157d4 100644 (file)
@@ -4146,9 +4146,9 @@ void DrawChooseLevelNr()
                 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);