]> git.ipfire.org Git - thirdparty/systemd.git/commit
ask-password: prevent buffer overrow when reading from keyring v239-18.2
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Mon, 13 May 2019 19:58:01 +0000 (16:58 -0300)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Fri, 29 Nov 2019 11:35:35 +0000 (12:35 +0100)
commit7200c0b173bec49c63ac5ecdf6d510d26e8c8271
tree2f3ff82b8132f3de283aaf9071c6824194c5711a
parent7c9077683df0c3959b1bcae973a05e114b15a600
ask-password: prevent buffer overrow 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)
(cherry picked from commit c6c8e0d097d6ba12471c6112c3fd339ea40329d5)

Resolves: #1777037
src/shared/ask-password-api.c