]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/string-util.c
string-util: allow taking SIZE_MAX as size to shorten to
authorLennart Poettering <lennart@poettering.net>
Wed, 6 Mar 2024 08:43:09 +0000 (09:43 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 6 Mar 2024 13:24:15 +0000 (13:24 +0000)
commitd49dc7bbe7538567b1fe04f5d1e08f0376193ef6
tree6606a7a91e2ad6311c8978b61413b22df2e1ff34
parent10d50d9eac0ed94576928a23e3fa525ddc49c2aa
string-util: allow taking SIZE_MAX as size to shorten to

This is useful for two reasons:

1. it addresses a potential overflow in a graceful way

2. Gives callers the ability to just pass SIZE_MAX for a NOP

Prompted by: #31341
src/basic/string-util.c
src/test/test-string-util.c