sd-device: use strjoina() more again in sd_device_new_from_subsystem_sysname()
authorLennart Poettering <lennart@poettering.net>
Mon, 10 May 2021 14:41:46 +0000 (16:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 May 2021 15:52:57 +0000 (17:52 +0200)
commitf5e775973a22e10e0813b56cb3e43d5d415979f7
treeffaa3b9a576d5c299c49b07376d9bc2dff6bb913
parenta6383f1e93553f55dcaac3a17a49f63211595164
sd-device: use strjoina() more again in sd_device_new_from_subsystem_sysname()

This reverts a major part of: e17c95af8e450caacde692875b30675cea75211f

Using format strings for concatenating strings is pretty unefficient,
and using PATH_MAX buffers unpretty as well. Let's revert to using
strjoina() as before.

However, to fix the fuzz issue at hand, let's explicitly verify the two
input strings ensuring they are valid path names. This includes a length
check (to 2K each), thus making things prettier, faster and using less
memory again.
src/libsystemd/sd-device/sd-device.c
src/test/test-udev-util.c