diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2025-11-27 18:17:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-27 18:17:48 +0200 |
| commit | 4dd5072e09df7bf487694fe6bdd16715b419c4f6 (patch) | |
| tree | 1797c7c245fb8de533ea5a017e5d45ba3534e3cd | |
| parent | d013d3ff2150ca425ff13ce69d0eab394153803a (diff) | |
| parent | 92110f9f3c9473de3d32bdc6202abb47315d41e7 (diff) | |
| download | accel-ppp-4dd5072e09df7bf487694fe6bdd16715b419c4f6.tar.gz accel-ppp-4dd5072e09df7bf487694fe6bdd16715b419c4f6.zip | |
Merge pull request #268 from nuclearcat/fixup-warnings
fixup! Add RADIUS blast attack protection with Message-Authenticator
| -rw-r--r-- | accel-pppd/radius/packet.c | 2 | ||||
| -rw-r--r-- | accel-pppd/radius/req.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/accel-pppd/radius/packet.c b/accel-pppd/radius/packet.c index 0ef9a0e3..87746d22 100644 --- a/accel-pppd/radius/packet.c +++ b/accel-pppd/radius/packet.c @@ -852,7 +852,7 @@ int rad_packet_send(struct rad_packet_t *pack, int fd, struct sockaddr_in *addr) uint8_t hmac[HMAC_MD5_LEN]; uint8_t *ptr = pack->buf; uint8_t *hmac_ptr = ptr + PACKET_SIGNED_OFFSET; - if (hmac_md5((const uint8_t *)pack->secret, strlen(pack->secret), pack->buf, pack->len, hmac) < 0) { + if (hmac_md5((const uint8_t *)pack->secret, strlen((const char *)pack->secret), pack->buf, pack->len, hmac) < 0) { log_emerg("radius:packet: failed to calculate HMAC\n"); return -1; } diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index 863174a2..e3c41996 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -78,10 +78,10 @@ static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, cons if (code == CODE_ACCESS_REQUEST && conf_blast_protection) { uint8_t buf[HMAC_MD5_LEN] = {0}; req->pack->message_authenticator = 1; - req->pack->secret = strdup(req->serv->secret); + req->pack->secret = (uint8_t *)strdup(req->serv->secret); if (rad_packet_add_octets(req->pack, NULL, "Message-Authenticator", buf, HMAC_MD5_LEN)) { - free(req->pack->secret); - req->pack->secret == NULL; + free(req->pack->secret); + req->pack->secret = NULL; goto out_err; } } |
