[syslinux:master] com32: write_sectors() sizing corrections

syslinux-bot for Robert luyao-c at 360.cn
Thu Aug 27 14:57:02 PDT 2015


Commit-ID:  d70168d1bfdc3883095666a7347dca78707afc3a
Gitweb:     http://www.syslinux.org/commit/d70168d1bfdc3883095666a7347dca78707afc3a
Author:     Robert <luyao-c at 360.cn>
AuthorDate: Sun, 23 Aug 2015 13:49:33 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Thu, 27 Aug 2015 16:54:29 -0400

com32: write_sectors() sizing corrections

Memory allocation and copy length should be SECTOR * size for sectors
operation.

Signed-off-by: Robert <luyao-c at 360.cn>
Signed-off-by: Gene Cumm <gene.cumm at gmail.com>

---
 com32/gpllib/disk/write.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/com32/gpllib/disk/write.c b/com32/gpllib/disk/write.c
index d183ade..3c9edff 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)


More information about the Syslinux-commits mailing list