From: Wilfried Göesgens Date: Thu, 5 Jul 2007 20:05:37 +0000 (+0000) Subject: * the memmove off by one, and some more optimization. X-Git-Tag: v7.86~3261 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=68647358e1bb8ba0bb129ab2a571ccf78685405e;p=citadel.git * the memmove off by one, and some more optimization. --- diff --git a/webcit/tools.c b/webcit/tools.c index 7964064f4..ff11a586b 100644 --- a/webcit/tools.c +++ b/webcit/tools.c @@ -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); }