Zeroed uninitialized bytes before writing compressed data

Compressed records may be written as full clusters even though cluster
tails are meaningless. This is to avoid the lower levels doing a read-
modify-write cycle. Be sure to zero the meaningless bytes to avoid
leaking information.

Contributed by Eric Biggers
pull/2/head
Jean-Pierre André 2015-04-17 11:31:47 +02:00
parent bd2c91d4a3
commit 5741f54529
1 changed files with 1 additions and 0 deletions

View File

@ -1131,6 +1131,7 @@ static s32 ntfs_comp_set(ntfs_attr *na, runlist_element *rl,
outbuf[compsz++] = 0;
/* write a full cluster, to avoid partial reading */
rounded = ((compsz - 1) | (clsz - 1)) + 1;
memset(&outbuf[compsz], 0, rounded - compsz);
written = write_clusters(vol, rl, offs, rounded, outbuf);
if (written != rounded) {
/*