Avoid variable-length array (vla)
This commit is contained in:
parent
8fd2739598
commit
aee0c5d0e3
4 changed files with 17 additions and 11 deletions
2
INFO
2
INFO
|
@ -1,2 +1,2 @@
|
|||
TestDisk & PhotoRec , https://www.cgsecurity.org
|
||||
Copyright (C) 1998-2017 Christophe GRENIER <grenier@cgsecurity.org>
|
||||
Copyright (C) 1998-2018 Christophe GRENIER <grenier@cgsecurity.org>
|
||||
|
|
|
@ -6,7 +6,7 @@ AC_INIT([testdisk],[7.1-WIP],[grenier@cgsecurity.org])
|
|||
AC_LANG(C)
|
||||
sinclude(acx_pthread.m4)
|
||||
sinclude(mkdir.m4)
|
||||
TESTDISKDATE="February 2018"
|
||||
TESTDISKDATE="March 2018"
|
||||
AC_SUBST(TESTDISKDATE)
|
||||
AC_DEFINE_UNQUOTED([TESTDISKDATE],"$TESTDISKDATE",[Date of release])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
|
@ -623,7 +623,6 @@ if test "x$with_jpeg" != "xno"; then
|
|||
else
|
||||
photorec_LDADD="$photorec_LDADD ${jpeg_lib_a}"
|
||||
qphotorec_LDADD="$qphotorec_LDADD ${jpeg_lib_a}"
|
||||
fidentify_LDADD="$fidentify_LDADD ${jpeg_lib_a}"
|
||||
fi
|
||||
have_jpeg=yes
|
||||
],AC_MSG_WARN(No jpeg library detected))
|
||||
|
@ -830,7 +829,7 @@ if test "x$have_ewf" != "xyes"; then
|
|||
fi
|
||||
fi
|
||||
#-Wconversion -Wmissing-noreturn -ffunction-sections -Wl,--gc-sections -Wl,--print-gc-sections
|
||||
for option in -Wdeclaration-after-statement -Wall -MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wnested-externs -Winline -Wdisabled-optimization -Wfloat-equal -Wmissing-format-attribute -Wmultichar -Wc++-compat -Wformat=2 -Wunreachable-code
|
||||
for option in -Wdeclaration-after-statement -Wall -MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wnested-externs -Winline -Wdisabled-optimization -Wfloat-equal -Wmissing-format-attribute -Wmultichar -Wc++-compat -Wformat=2 -Wunreachable-code -Wvla
|
||||
do
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $option"
|
||||
|
@ -845,7 +844,7 @@ done
|
|||
unset option
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
for option in -Wall -MD -Wpointer-arith -Wmissing-declarations -Wshadow -Wwrite-strings -W -Wcast-align -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wdisabled-optimization -Wmissing-format-attribute -Wmultichar -Wformat=2 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC
|
||||
for option in -Wall -MD -Wpointer-arith -Wmissing-declarations -Wshadow -Wwrite-strings -W -Wcast-align -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wdisabled-optimization -Wmissing-format-attribute -Wmultichar -Wformat=2 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -Wvla
|
||||
do
|
||||
SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $option"
|
||||
|
|
|
@ -910,11 +910,12 @@ static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const s
|
|||
|
||||
int check_OS2MB(disk_t *disk, partition_t *partition, const int verbose)
|
||||
{
|
||||
unsigned char buffer[disk->sector_size];
|
||||
if((unsigned)disk->pread(disk, &buffer, disk->sector_size, partition->part_offset) != disk->sector_size)
|
||||
unsigned char *buffer=(unsigned char *)MALLOC(disk->sector_size);
|
||||
if((unsigned)disk->pread(disk, buffer, disk->sector_size, partition->part_offset) != disk->sector_size)
|
||||
{
|
||||
screen_buffer_add("check_OS2MB: Read error\n");
|
||||
log_error("check_OS2MB: Read error\n");
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
if(test_OS2MB(disk,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0)
|
||||
|
@ -924,9 +925,11 @@ int check_OS2MB(disk_t *disk, partition_t *partition, const int verbose)
|
|||
log_info("\n\ntest_OS2MB()\n");
|
||||
log_partition(disk, partition);
|
||||
}
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
partition->upart_type=UP_OS2MB;
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
12
src/hpfs.c
12
src/hpfs.c
|
@ -28,6 +28,9 @@
|
|||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h> /* free */
|
||||
#endif
|
||||
#include "types.h"
|
||||
#include "common.h"
|
||||
#include "fat.h"
|
||||
|
@ -83,11 +86,12 @@ int recover_HPFS(disk_t *disk_car, const struct fat_boot_sector *hpfs_header, pa
|
|||
|
||||
int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
|
||||
{
|
||||
unsigned char buffer[disk_car->sector_size];
|
||||
if((unsigned)disk_car->pread(disk_car, &buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
|
||||
unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
|
||||
if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
|
||||
{
|
||||
screen_buffer_add("check_HPFS: Read error\n");
|
||||
log_error("check_HPFS: Read error\n");
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
if(test_HPFS(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0)
|
||||
|
@ -97,10 +101,10 @@ int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
|
|||
log_info("\n\ntest_HPFS()\n");
|
||||
log_partition(disk_car,partition);
|
||||
}
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
set_HPFS_info(partition);
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue