]> code.citadel.org Git - citadel.git/commitdiff
* tools.c: don't crash when striplt() is called with a zero-length string
authorArt Cancro <ajc@citadel.org>
Wed, 1 Dec 2004 16:48:24 +0000 (16:48 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 1 Dec 2004 16:48:24 +0000 (16:48 +0000)
webcit/ChangeLog
webcit/tools.c

index 4cd8d1afa4e3a2961530622ba33396030ef68bc3..3cae42833a80247f3325b7c6708bc4bba6625d97 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 525.2  2004/12/01 16:48:24  ajc
+* tools.c: don't crash when striplt() is called with a zero-length string
+
 Revision 525.1  2004/11/12 18:02:36  ajc
 * Updated the richtext editor (new version from Kevin Roth's site)
 
@@ -2112,3 +2115,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index 4a2d35b637f488c2fd1caf8463a26b9272b72e75..7ec1b83196a21ed2b15ef2763eabebd027ae2f3f 100644 (file)
@@ -311,8 +311,10 @@ int pattern2(char *search, char *patn)
  */
 void striplt(char *buf)
 {
+       if (strlen(buf) == 0) return;
        while ((strlen(buf) > 0) && (isspace(buf[0])))
                strcpy(buf, &buf[1]);
+       if (strlen(buf) == 0) return;
        while (isspace(buf[strlen(buf) - 1]))
                buf[strlen(buf) - 1] = 0;
 }