Skip to content

Commit

Permalink
check that starting offset of partition 1 is beyond MBR area
Browse files Browse the repository at this point in the history
  • Loading branch information
efii committed Jul 23, 2013
1 parent 762d32a commit 3413153
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nand-part.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ int main (int argc, char **argv)
argc--;
argv++;
}

if (start < MBR_SIZE * MBR_COPY_NUM / 512) {
printf("Partition 1 starting offset must be at least %d\n", MBR_SIZE * MBR_COPY_NUM / 512);
close(fd);
return -3;
}

for (i = 0; i < argc; i++) {
if (sscanf(argv[i], "%s %d %d", names[i], &lens[i], &user_types[i]) < 2) {
printf("bad 'name len' argument\n");
Expand Down

0 comments on commit 3413153

Please sign in to comment.