mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 18:43:12 -04:00
ecryptfs: reject too-small tag 70 packets
ecryptfs_parse_tag_70_packet() subtracts fixed metadata fields from the
parsed packet body size to derive the encrypted filename size. A
malformed packet with a body smaller than those fixed fields can underflow
that size calculation.
Reject tag 70 packets before the subtraction unless the body contains the
signature, cipher code, and at least one byte of encrypted filename data.
Fixes: 9c79f34f7e ("eCryptfs: Filename Encryption: Tag 70 packets")
Cc: <stable@vger.kernel.org>
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Signed-off-by: Tyler Hicks <code@tyhicks.com>
This commit is contained in:
committed by
Tyler Hicks
parent
8b2ec0f56f
commit
e97bbe1b2b
@@ -894,6 +894,12 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size,
|
||||
"rc = [%d]\n", __func__, rc);
|
||||
goto out;
|
||||
}
|
||||
if (s->parsed_tag_70_packet_size < (ECRYPTFS_SIG_SIZE + 2)) {
|
||||
ecryptfs_printk(KERN_WARNING, "Invalid packet size [%zd]\n",
|
||||
s->parsed_tag_70_packet_size);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
s->block_aligned_filename_size = (s->parsed_tag_70_packet_size
|
||||
- ECRYPTFS_SIG_SIZE - 1);
|
||||
if ((1 + s->packet_size_len + s->parsed_tag_70_packet_size)
|
||||
|
||||
Reference in New Issue
Block a user