]> git.ozlabs.org Git - ppp.git/commit
pppd: Limit memory accessed by string formats with max length specified
authorPaul Mackerras <paulus@ozlabs.org>
Sun, 29 Dec 2019 22:24:54 +0000 (09:24 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Sun, 29 Dec 2019 22:24:54 +0000 (09:24 +1100)
commitb311e98b1d4775f7db36b81697ed8996809f3639
tree95da0453219f282f576d66d557dcd71c36377f21
parent3ea9de913739667e2131d67d979ff175ec394e67
pppd: Limit memory accessed by string formats with max length specified

Currently, calls to [v]slprintf that have a string format (%s, %v,
%q) with a maximum length specified (e.g. %.20s) do a strlen() on
the string, and can therefore access memory beyond the maximum
length specified.  If the string is not null-terminated, this could
result in an out-of-bounds read.

This makes vslprintf use strnlen() in cases where a maximum length
has been specified, so that we don't access the string beyond the
maximum length that was given.

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