netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 14 May 2020 12:14:23 +0000 (14:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jun 2020 06:16:46 +0000 (08:16 +0200)
commit8ef576491c9ea0166c7a00ff723470e220ff1d4a
tree0f8f636956010ba6c1971e2058c4f0a9fdf02205
parent12e427591ed82aa71c18bb544cbae15e71b80f59
netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code

commit 4c559f15efcc43b996f4da528cd7f9483aaca36d upstream.

Dan Carpenter says: "Smatch complains that the value for "cmd" comes
from the network and can't be trusted."

Add pptp_msg_name() helper function that checks for the array boundary.

Fixes: f09943fefe6b ("[NETFILTER]: nf_conntrack/nf_nat: add PPTP helper port")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/netfilter/nf_conntrack_pptp.h
net/ipv4/netfilter/nf_nat_pptp.c
net/netfilter/nf_conntrack_pptp.c