summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-08-09 07:16:38 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-08-09 08:58:08 +0300
commit9d47f220a09eb30750f85973dc2f0d4157eb78be (patch)
tree0059140bb0a12f8be9977aae5d27cb4c5704c24b /accel-pppd
parent0d7cd3a4ae6beed4eab485052a5e27b0772f15c6 (diff)
downloadaccel-ppp-9d47f220a09eb30750f85973dc2f0d4157eb78be.tar.gz
accel-ppp-9d47f220a09eb30750f85973dc2f0d4157eb78be.zip
pptp: reject a malformed bind address
An unparsable bind= value went through inet_addr() unchecked and became 255.255.255.255, so the only symptom was bind() failing with "Cannot assign requested address", which does not point at the configuration. Parse with inet_aton() and name the offending value instead. Also zero the address before filling it in, so the padding passed to bind() is not stack garbage.
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index ec054e67..7cfccce1 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -911,12 +911,17 @@ static void pptp_init(void)
fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC);
+ memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
opt = conf_get_opt("pptp", "bind");
- if (opt)
- addr.sin_addr.s_addr = inet_addr(opt);
- else
+ if (opt) {
+ if (!inet_aton(opt, &addr.sin_addr)) {
+ log_emerg("pptp: failed to parse bind address '%s'\n", opt);
+ close(serv.hnd.fd);
+ return;
+ }
+ } else
addr.sin_addr.s_addr = htonl(INADDR_ANY);
opt = conf_get_opt("pptp", "port");