drm-shim: add __readlink_chk as readlink with overflow check
authorMax Lee <endlesspring@google.com>
Wed, 12 Oct 2022 03:41:12 +0000 (14:41 +1100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Dec 2022 21:05:15 +0000 (21:05 +0000)
commit2db09f5b22ca0af41e671d0b754b1b9ed38b8f54
tree116c1d75e65972649c263a6777b075a56dbdb7b5
parent3068f046bccfd09da6087b415a47d9cadb7386a4
drm-shim: add __readlink_chk as readlink with overflow check

As per Linux Standard Base Core Specification 4.0, __readlink_chk
display value of a symbolic link, with buffer overflow checking.

if size > buflen, abort() is called.

Signed-off-by: Max Lee <endlesspring@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19045>
src/drm-shim/drm_shim.c