summaryrefslogtreecommitdiffstats
path: root/src/partsun.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-04-09 12:48:38 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-04-09 12:48:38 +0200
commit1f42c92ca563b598d2df84834a4a7839e65cfd34 (patch)
tree5acbfd3885d28236a69701d70c5fb3e9a9a93dce /src/partsun.c
parent52190cd076ba6b47d59eeaf888a5f0029bd8d3a1 (diff)
Check that disk sector_size is 512 bytes at least
Diffstat (limited to 'src/partsun.c')
-rw-r--r--src/partsun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/partsun.c b/src/partsun.c
index 0c749e7..15afebf 100644
--- a/src/partsun.c
+++ b/src/partsun.c
@@ -132,7 +132,10 @@ static list_part_t *read_part_sun(disk_t *disk_car, const int verbose, const int
unsigned int i;
sun_disklabel *sunlabel;
list_part_t *new_list_part=NULL;
- unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
+ unsigned char *buffer;
+ if(disk_car->sector_size < DEFAULT_SECTOR_SIZE)
+ return NULL;
+ buffer=(unsigned char *)MALLOC(disk_car->sector_size);
screen_buffer_reset();
sunlabel=(sun_disklabel*)buffer;
if(disk_car->pread(disk_car, buffer, DEFAULT_SECTOR_SIZE, (uint64_t)0) != DEFAULT_SECTOR_SIZE)