diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-12-10 16:47:26 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2024-12-10 20:20:50 +0100 |
commit | edd0a3c5e99a854de98fa9de9e6311a9f6e5fc8c (patch) | |
tree | 081dad52eed3219da981a0a917132648251b3b0e | |
parent | TEST-07-PID: wait for sleep command being executed by sd-executor (diff) | |
download | systemd-edd0a3c5e99a854de98fa9de9e6311a9f6e5fc8c.tar.xz systemd-edd0a3c5e99a854de98fa9de9e6311a9f6e5fc8c.zip |
copy: do not try to copy zero size data
Hopefully fixes the following sanitizer issue:
===
[ 3754.797377] systemd-journald[776]: ../src/src/shared/copy.c:463:37: runtime error: variable length array bound evaluates to non-positive value 0
[ 3755.101713] systemd-journald[776]: Received SIGTERM from PID 1 (systemd).
[ 3755.124580] systemd-journald[776]: Journal stopped
Found 1 sanitizer issues (0 internal, 0 asan, 0 ubsan, 0 msan).
===
-rw-r--r-- | src/shared/copy.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/shared/copy.c b/src/shared/copy.c index 836753cc75..5221397da5 100644 --- a/src/shared/copy.c +++ b/src/shared/copy.c @@ -346,6 +346,8 @@ int copy_bytes_full( /* Make sure we're not copying more than the current data segment. */ m = MIN(m, (size_t) e - c); + if (m <= 0) + continue; } /* First try copy_file_range(), unless we already tried */ |