summaryrefslogtreecommitdiffstats
path: root/src/filegen.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-10-15 12:07:51 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2011-10-15 12:07:51 +0200
commit7e5749b013e101aa39052a7fcd89bdd7cf276ce6 (patch)
treed6d6ee108dafbc016db3b98378349bef625cfe0c /src/filegen.c
parent6eb06797ace40b9a8650a05ff66f725f1af7a9d0 (diff)
PhotoRec: check that buffer_size >= 0 in file_rename() and file_rename_unicode()
Diffstat (limited to 'src/filegen.c')
-rw-r--r--src/filegen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/filegen.c b/src/filegen.c
index 68d68e4..2f21c15 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -364,6 +364,8 @@ void file_rename(const char *old_filename, const unsigned char *buffer, const in
char *dst;
char *directory_sep;
int len=strlen(old_filename)+1;
+ if(buffer_size<0)
+ return ;
if(offset < buffer_size && buffer!=NULL)
len+=buffer_size-offset+1;
if(new_ext!=NULL)
@@ -457,6 +459,8 @@ void file_rename_unicode(const char *old_filename, const unsigned char *buffer,
char *dst;
char *directory_sep;
int len=strlen(old_filename)+1;
+ if(buffer_size<0)
+ return ;
if(offset < buffer_size && buffer!=NULL)
len+=buffer_size-offset;
if(new_ext!=NULL)