]> git.ipfire.org Git - thirdparty/util-linux.git/commit
sfdisk: Avoid out of boundary read with readline
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 17 Feb 2019 21:55:29 +0000 (22:55 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Feb 2019 12:05:14 +0000 (13:05 +0100)
commita6fb1ce79dba98c01678561236e9364bedc02b38
treef8b3588800a3f92f2c81b24db1fa7a4c5dbc1f2b
parent9a76780f861628aeb5af7d799f0ae004a09fa360
sfdisk: Avoid out of boundary read with readline

It is not guaranteed that the returned string of readline() actually
contains as many bytes as buf can contain.

If bufsz is larger than the allocated memory by readline, an out of
boundary read occurs and leads to undefined behaviour. Most likely
that will be a crash.

This can be reproduced when readline-support is compiled in and when
you directly enter "quit" and "n" (to not write changes back to disk)
when sfdisk was called with any given device.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
disk-utils/sfdisk.c