summaryrefslogtreecommitdiffstats
path: root/src/hdaccess.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-06-24 08:39:47 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-06-24 08:39:47 +0200
commit2912e6cb70389382209af566fafdffea43dec555 (patch)
tree28dee573497165d4b740705aad2db604200e4ab0 /src/hdaccess.c
parent6ac98cc960920aa207248294cca28c0e389279b6 (diff)
Avoid division by zero in autoset_geometry().
Thanks to Adel KHALDI from Blue Frost Security GmbH for reporting the problem.
Diffstat (limited to 'src/hdaccess.c')
-rw-r--r--src/hdaccess.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 460acf7..fa1d031 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -1370,7 +1370,7 @@ static void autoset_geometry(disk_t *disk, const unsigned char *buffer, const in
geometry.bytes_per_sector=0;
disk->arch->get_geometry_from_mbr(buffer, verbose, &geometry);
disk->autodetect=1;
- if(geometry.sectors_per_head > 0)
+ if(geometry.sectors_per_head > 0 && geometry.heads_per_cylinder > 0)
{
disk->geom.heads_per_cylinder=geometry.heads_per_cylinder;
disk->geom.sectors_per_head=geometry.sectors_per_head;