Fix off-by-one error in msdosfs FAT32 volume label copying
I dropped the + 1 from the other two instances in each file but failed to do so for this one, resulting in a more egregious buffer overread than the one I was fixing (since the read character ended up in the output if there was space). Reported by: Jenkins Fixes: 34fb1c133c5b ("Fix intra-object buffer overread for labeled msdosfs volumes")
This commit is contained in:
parent
4827bf76bc
commit
63d24336fd
@ -136,7 +136,7 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size)
|
||||
if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME,
|
||||
sizeof(pfat32_bsbpb->BS_VolLab)) != 0) {
|
||||
copysize = MIN(size - 1,
|
||||
sizeof(pfat32_bsbpb->BS_VolLab) + 1);
|
||||
sizeof(pfat32_bsbpb->BS_VolLab));
|
||||
memcpy(label, pfat32_bsbpb->BS_VolLab, copysize);
|
||||
label[copysize] = '\0';
|
||||
goto endofchecks;
|
||||
|
@ -104,7 +104,7 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size)
|
||||
if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME,
|
||||
sizeof(pfat32_bsbpb->BS_VolLab)) != 0) {
|
||||
copysize = MIN(size - 1,
|
||||
sizeof(pfat32_bsbpb->BS_VolLab) + 1);
|
||||
sizeof(pfat32_bsbpb->BS_VolLab));
|
||||
memcpy(label, pfat32_bsbpb->BS_VolLab, copysize);
|
||||
label[copysize] = '\0';
|
||||
goto endofchecks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user