From fe9b27c1bbd810a5e1b39ca3b6a67cbf4a1ffecb Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 14 Oct 2003 03:09:47 +0000 Subject: [PATCH] * routines2.c: fixed an off-by-one error in filename sanitization for client file uploads --- citadel/ChangeLog | 5 +++++ citadel/routines2.c | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 4bc278d28..a946acb7c 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/routines2.c b/citadel/routines2.c index 7c5821e7f..efc81a6e2 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -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); } -- 2.39.2