]> skyeroc.xyz Git - dgamelaunch/commitdiff
Just to be sure, make the tty playback buffer explicitly null terminated.
authorPasi Kallinen <paxed@alt.org>
Sun, 18 Oct 2009 12:05:16 +0000 (12:05 +0000)
committerPasi Kallinen <paxed@alt.org>
Sun, 18 Oct 2009 12:05:16 +0000 (12:05 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@486 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

ttyplay.c

index 3d80f56e693d60aac7822039d940d0e52ff02090..c269f46d67a1f34335ebbfd5d7e9b18407adb250 100644 (file)
--- a/ttyplay.c
+++ b/ttyplay.c
@@ -136,7 +136,7 @@ ttyread (FILE * fp, Header * h, char **buf, int pread)
       exit (-21);
     }
 
-  *buf = malloc (h->len);
+  *buf = malloc (h->len + 1);
   if (*buf == NULL)
     {
       perror ("malloc");
@@ -148,6 +148,7 @@ ttyread (FILE * fp, Header * h, char **buf, int pread)
       fseek (fp, offset, SEEK_SET);
       return READ_EOF;
     }
+  (*buf)[h->len] = 0;
   return READ_DATA;
 }