[MPlayer-dev-eng] [PATCH] off-by-one error in playtreeparser.c

Moritz Bunkus moritz at bunkus.org
Sun Jan 12 12:34:36 CET 2003


Hi.

This patch fixes an off-by-one error in strstrip (playtreeparser.c).

I'll commit this if no one objects.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)
-------------- next part --------------
Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.15
diff -u -r1.15 playtreeparser.c
--- playtreeparser.c	11 Jan 2003 21:01:48 -0000	1.15
+++ playtreeparser.c	12 Jan 2003 11:37:25 -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


More information about the MPlayer-dev-eng mailing list