changeset 28183:b197740bf718

Add zero termination missing in two cases.
author reimar
date Thu, 01 Jan 2009 09:37:02 +0000
parents 26ab2d01157f
children 0fb5551413f7
files playtreeparser.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/playtreeparser.c	Thu Jan 01 09:35:25 2009 +0000
+++ b/playtreeparser.c	Thu Jan 01 09:37:02 2009 +0000
@@ -53,6 +53,7 @@
   if(p->buffer == NULL) {
     p->buffer = malloc(BUF_STEP);
     p->buffer_size = BUF_STEP;
+    p->buffer[0] = 0;
     p->iter = p->buffer;
   }
 
@@ -110,9 +111,9 @@
     if(end[0] != '\0') {
       p->buffer_end -= end-p->iter;
       memmove(p->buffer,end,p->buffer_end);
-      p->buffer[p->buffer_end] = '\0';
     } else
       p->buffer_end = 0;
+    p->buffer[p->buffer_end] = '\0';
     p->iter = p->buffer;
   } else
     p->iter = end;