changeset 8907:e82149e697a7

bunkus: Another nice off-by-one :)
author mosu
date Sun, 12 Jan 2003 11:45:49 +0000
parents 50ef2de1d9c4
children 8689fa04b837
files playtreeparser.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/playtreeparser.c	Sun Jan 12 10:12:13 2003 +0000
+++ b/playtreeparser.c	Sun Jan 12 11:45:49 2003 +0000
@@ -35,11 +35,13 @@
 strstrip(char* str) {
   char* i;
 
+  if (str==NULL)
+    return;
   for(i = str ; i[0] != '\0' && strchr(WHITES,i[0]) != NULL; i++)
     /* NOTHING */;
   if(i[0] != '\0') {
-    memmove(str,i,strlen(i));
-    for(i = str + strlen(str) ; strchr(WHITES,i[0]) != NULL; i--)
+    memmove(str,i,strlen(i) + 1);
+    for(i = str + strlen(str) - 1 ; strchr(WHITES,i[0]) != NULL; i--)
       /* NOTHING */;
     i[1] = '\0';
   } else