]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-device: do no allocate strings of unknown length on the stack
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 May 2021 14:49:41 +0000 (16:49 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 6 May 2021 12:51:08 +0000 (14:51 +0200)
commit5172ef4a58bda5be18dcdbbe0abd2c6bb4f08743
tree23671f963e60d668b937b65cbd32f6efa2bd7fc0
parent964a13d17be3426ecf539a5155e2cb8b4c16fb31
sd-device: do no allocate strings of unknown length on the stack

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33881.

Not only we would duplicate unknown input on the stack, we would do it
over and over. So let's first check that the input has reasonable length,
but also allocate just one fixed size buffer.

(cherry picked from commit e17c95af8e450caacde692875b30675cea75211f)
src/libsystemd/sd-device/sd-device.c
test/fuzz/fuzz-journald-kmsg/oss-fuzz-33881 [new file with mode: 0644]