aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorRobert <luyao-c@360.cn>2015-08-23 13:49:33 -0400
committerGene Cumm <gene.cumm@gmail.com>2015-08-27 16:54:29 -0400
commitd70168d1bfdc3883095666a7347dca78707afc3a (patch)
treecf36d7592f03d1172365a3cdc1481d8e98006f79 /com32
parente466d2498604c8eea055a8e98284d65311073b39 (diff)
downloadsyslinux-d70168d1bfdc3883095666a7347dca78707afc3a.tar.gz
syslinux-d70168d1bfdc3883095666a7347dca78707afc3a.tar.xz
syslinux-d70168d1bfdc3883095666a7347dca78707afc3a.zip
com32: write_sectors() sizing corrections
Memory allocation and copy length should be SECTOR * size for sectors operation. Signed-off-by: Robert <luyao-c@360.cn> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/gpllib/disk/write.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/com32/gpllib/disk/write.c b/com32/gpllib/disk/write.c
index d183adef..3c9edffd 100644
--- a/com32/gpllib/disk/write.c
+++ b/com32/gpllib/disk/write.c
@@ -40,7 +40,7 @@ int write_sectors(const struct driveinfo *drive_info, const unsigned int lba,
void *buf;
int rv = -1;
- buf = lmalloc(size);
+ buf = lmalloc(SECTOR * size);
if (!buf)
return -1;
@@ -48,7 +48,7 @@ int write_sectors(const struct driveinfo *drive_info, const unsigned int lba,
if (!dapa)
goto out;
- memcpy(buf, data, size);
+ memcpy(buf, data, SECTOR * size);
memset(&inreg, 0, sizeof inreg);
if (drive_info->ebios) {
@@ -123,7 +123,7 @@ int write_verify_sectors(struct driveinfo *drive_info,
const unsigned int lba,
const void *data, const int size)
{
- char *rb = malloc(SECTOR * size * sizeof(char));
+ char *rb = malloc(SECTOR * size);
int status;
if (write_sectors(drive_info, lba, data, size) == -1)