test-env-util: Verify that \r is disallowed in env var values
authorHans Ulrich Niedermann <hun@n-dimensional.de>
Wed, 21 Oct 2020 20:40:18 +0000 (22:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 Oct 2020 12:57:02 +0000 (14:57 +0200)
commite1e8c60af73fa2c61539c9e201a1db623be55b69
tree7d6017d5d4162bfffa84993465ce6d12ee852902
parentd97531034211c430dd1844078ca0705b0115039c
test-env-util: Verify that \r is disallowed in env var values

This adds tests to make sure that basic/env-util considers environment
variables containing \r characters invalid, and that it removes such
variables during environment cleanup in strv_env_clean*().

test-env-util has not verified this behaviour before.

As \r characters can be used to hide information, disallowing them
helps with systemd's security barrier role, even when the \r
character comes as part of a DOS style (\r\n) line ending.

Prompted-by: https://github.com/systemd/systemd/issues/17378
src/test/test-env-util.c