Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert authored and geneC committed Aug 27, 2015
1 parent e466d24 commit d70168d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions com32/gpllib/disk/write.c
Expand Up @@ -40,15 +40,15 @@ 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;

dapa = lmalloc(sizeof(*dapa));
if (!dapa)
goto out;

memcpy(buf, data, size);
memcpy(buf, data, SECTOR * size);
memset(&inreg, 0, sizeof inreg);

if (drive_info->ebios) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d70168d

Please sign in to comment.