ask-password: prevent buffer overflow when reading from keyring
authorMichael Biebl <biebl@debian.org>
Thu, 27 Jun 2019 13:02:40 +0000 (15:02 +0200)
committerRaspbian forward porter <root@raspbian.org>
Sat, 13 Jul 2019 01:30:09 +0000 (02:30 +0100)
commitc2c4fcd3af374af1b9b71b5d2981a0cd16adea9e
tree45d5e5c689d6f76e5b2782f7900cd7d3ea07ef99
parent7ca4bce220204b0f349fb18edb1a411d4fafcd73
ask-password: prevent buffer overflow when reading from keyring

When we read from keyring, a temporary buffer is allocated in order to
determine the size needed for the entire data. However, when zeroing that area,
we use the data size returned by the read instead of the lesser size allocate
for the buffer.

That will cause memory corruption that causes systemd-cryptsetup to crash
either when a single large password is used or when multiple passwords have
already been pushed to the keyring.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
(cherry picked from commit 59c55e73eaee345e1ee67c23eace8895ed499693)

Gbp-Pq: Name ask-password-prevent-buffer-overflow-when-reading-from-ke.patch
src/shared/ask-password-api.c