aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-cli-disk.c
diff options
context:
space:
mode:
authorerwan <erwan@r1.paris>2009-08-20 00:19:44 +0200
committererwan <erwan@r1.paris>2009-08-20 00:19:44 +0200
commitf856e30a7162319b9743d6742cec9d41b33269b5 (patch)
treeb834d2c54fc002cd2defe3a1b0fe6a97cc847d6a /com32/hdt/hdt-cli-disk.c
parent43ec93d70fba9f7d014b295e2c49035283596e1d (diff)
downloadhdt-f856e30a7162319b9743d6742cec9d41b33269b5.tar.gz
hdt-f856e30a7162319b9743d6742cec9d41b33269b5.tar.xz
hdt-f856e30a7162319b9743d6742cec9d41b33269b5.zip
hdt: Fixing memory corruption
Impact: Improve stability In some case, sectors_to_size can return a 8 char long string like "1000 MiB". In such case, some buffer were corrupted. This is now fixed by a size[9] instead of size[8].
Diffstat (limited to 'com32/hdt/hdt-cli-disk.c')
-rw-r--r--com32/hdt/hdt-cli-disk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c
index ffbec4f1..ef67abf6 100644
--- a/com32/hdt/hdt-cli-disk.c
+++ b/com32/hdt/hdt-cli-disk.c
@@ -62,7 +62,7 @@ static void show_partition_information(struct driveinfo *drive_info,
int partition_offset,
int nb_partitions_seen)
{
- char size[8];
+ char size[9];
char *parttype;
int error = 0;
char error_buffer[MAX_DISK_ERRNO];
@@ -122,7 +122,7 @@ void main_show_disk(int argc, char **argv,
int i = drive - 0x80;
struct driveinfo *d = &hardware->disk_info[i];
char error_buffer[MAX_DISK_ERRNO];
- char disk_size[8];
+ char disk_size[9];
detect_disks(hardware);
if (!hardware->disk_info[i].cbios)
@@ -177,7 +177,7 @@ void disks_summary(int argc __unused, char** argv __unused,
if (!hardware->disk_info[i].cbios)
continue; /* Invalid geometry */
struct driveinfo *d = &hardware->disk_info[i];
- char disk_size[8];
+ char disk_size[9];
if ((int) d->edd_params.sectors > 0)
sectors_to_size((int) d->edd_params.sectors, disk_size);