home · contact · privacy
Corrected window title creation.
[plomrogue] / src / wincontrol.c
index 715aebb4d5d856964e12071630c5bd2ffb0bd10c..793b75e2d6205b896656da6ca6cf077189b77e6d 100644 (file)
@@ -43,7 +43,8 @@ extern struct Win * init_win_from_file(struct World * world, char * w_name,
     err = "Trouble in init_win_from_file() with fgets().";
     exit_err(NULL == fgets(line, linemax, file), world, err);
     char * title = malloc(strlen(line));
-    memcpy(title, line, strlen(line) - 1);
+    memcpy(title, line, strlen(line) - 1);   /* Eliminate newline char at end */
+    title[strlen(line) - 1] = '\0';          /* of string.                    */
     exit_err(NULL == fgets(line, linemax, file), world, err);
     int16_t height = atoi(line);
     exit_err(NULL == fgets(line, linemax, file), world, err);