summaryrefslogtreecommitdiffstats
path: root/src/filegen.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-04-12 11:46:16 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-04-12 11:46:16 +0200
commit2b1c5f5c278c2ea329d94e288605e307990864de (patch)
treea61da3c8d5b10b1dc640fc1129d80ee83fcd6bb9 /src/filegen.c
parentc436452a5232c5083ac90bdc8dbeeafa3d0e34c9 (diff)
Replace '/' and '\' by '_' when extracting the original filename from a file
Diffstat (limited to 'src/filegen.c')
-rw-r--r--src/filegen.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/filegen.c b/src/filegen.c
index e2b1dbd..fd2b774 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -367,7 +367,19 @@ void file_rename(const char *old_filename, const unsigned char *buffer, const in
*dst++ = '_';
/* Add original filename */
while(off<buffer_size && buffer[off]!='\0')
- *dst++ = buffer[off++];
+ {
+ switch(buffer[off])
+ {
+ case '/':
+ case '\\':
+ *dst++ = '_';
+ break;
+ default:
+ *dst++ = buffer[off];
+ break;
+ }
+ off++;
+ }
/* Add extension */
while(*ext!='\0')
*dst++ = *ext++;