* routines2.c: fixed an off-by-one error in filename sanitization for
authorArt Cancro <ajc@citadel.org>
Tue, 14 Oct 2003 03:09:47 +0000 (03:09 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 14 Oct 2003 03:09:47 +0000 (03:09 +0000)
  client file uploads

citadel/ChangeLog
citadel/routines2.c

index 4bc278d284949aed09a641a141109b1ae4a344e8..a946acb7c03342260e23d760c9f8e8ca6272ca60 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 610.21  2003/10/14 03:09:47  ajc
+ * routines2.c: fixed an off-by-one error in filename sanitization for
+   client file uploads
+
  Revision 610.20  2003/10/10 05:43:57  ajc
  * citadel.c:  Reworded one of the prompts
 
@@ -5044,3 +5048,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 7c5821e7f62a6283f489885a0ffa44939be23cb9..efc81a6e202df26cb03c060f18c97b084c33d215 100644 (file)
@@ -257,10 +257,13 @@ void cli_upload(CtdlIPC *ipc)
                /* basename of filename */
                strcpy(tbuf, flnm);
                if (haschar(tbuf, '/'))
-                       strcpy(tbuf, strrchr(tbuf, '/'));
+                       extract_token(tbuf, flnm,
+                               num_tokens(tbuf, '/') - 1,
+                               '/'
+                       );
                /* filename.1, filename.2, etc */
                if (a > 0) {
-                       sprintf(buf + strlen(buf), ".%d", a);
+                       sprintf(&tbuf[strlen(tbuf)], ".%d", a);
                }
                /* Try upload */
                r = CtdlIPCFileUpload(ipc, tbuf, desc, flnm, progress, buf);
@@ -269,7 +272,8 @@ void cli_upload(CtdlIPC *ipc)
                else
                        break;
                ++a;
-       };
+       }
+       if (a > 0) scr_printf("Saved as '%s'\n", tbuf);
 }