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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 9 Jul 2021 16:25:39 +0000 (18:25 +0200)
commit9962f072342f8b5c5c49c09a6792d5b67ed4fdad
tree944934c2b375ede6ef38cccc03526956928e792a
parentb97c113704056c386574c047928e410c6c1e89ae
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.

(cherry picked from commit f5e775973a22e10e0813b56cb3e43d5d415979f7)
src/libsystemd/sd-device/sd-device.c
src/test/test-udev-util.c