]> git.ozlabs.org Git - ppp.git/commit
pppd: Avoid use of strnlen (and strlen) in vslprintf
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 31 Dec 2019 00:12:07 +0000 (11:12 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 31 Dec 2019 01:29:57 +0000 (12:29 +1100)
commit5d034034a61c37dc5d590753cb7a601d2ee2b871
treea2e2a0364811fdc7f22bc5a0fc3111498debcfd6
parenta1e950a04bcd9b19be22c19aa3bdaa66d9538701
pppd: Avoid use of strnlen (and strlen) in vslprintf

Commit b311e98b ("pppd: Limit memory accessed by string formats with
max length specified") added calls to strnlen() in vslprintf().
Unfortunately, strnlen() is not provided in some standard C libraries.
This changes the code to avoid using strnlen().  Using the observation
that the number of characters we can use from the input string is
bounded by buflen, the number of bytes of output buffer available,
we can also avoid doing strlen() on a potentially long string.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd/utils.c