* the memmove off by one, and some more optimization.
authorWilfried Göesgens <willi@citadel.org>
Thu, 5 Jul 2007 20:05:37 +0000 (20:05 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 5 Jul 2007 20:05:37 +0000 (20:05 +0000)
webcit/tools.c

index 7964064f4a8c495e54152db9afc5344aa3bbc81e..ff11a586b332d6d2e4df93bff7c2b2f8848b3d02 100644 (file)
@@ -120,7 +120,9 @@ void remove_token(char *source, int parmnum, char separator)
                return;
        }
 
-       for (i = 0; i < slen; ++i) {
+       for (i = 0; 
+            ( (i < slen)  && (end == -1) ); 
+            ++i) {
                if ((start < 0) && (curr_parm == parmnum)) {
                        start = i;
                }
@@ -135,9 +137,9 @@ void remove_token(char *source, int parmnum, char separator)
        }
 
        if (end < 0)
-               end = strlen(source);
+               end = slen;
 
-       memmove(&source[start], &source[end], slen - end);
+       memmove(&source[start], &source[end], slen - end + 1);
 }