summaryrefslogtreecommitdiff
path: root/accel-pppd/radius
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-06-17 17:14:26 +0400
committerDmitry Kozlov <xeb@mail.ru>2014-06-17 17:14:26 +0400
commitc69fb2ed39346fd5091a4e30606cb5bb866aa432 (patch)
tree757fb839c2a7a852a08ae36542f7e9cee2b55a7f /accel-pppd/radius
parent861ea516ec07b9a67567c439a6a4077d8a4fd518 (diff)
downloadaccel-ppp-c69fb2ed39346fd5091a4e30606cb5bb866aa432.tar.gz
accel-ppp-c69fb2ed39346fd5091a4e30606cb5bb866aa432.zip
auth_mschap,radius: fixed improper passing MS-CHAP-Error, Reply-Message to auth modules
Passed strings was not nullterminated
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r--accel-pppd/radius/auth.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c
index 675f9486..f4efe3b9 100644
--- a/accel-pppd/radius/auth.c
+++ b/accel-pppd/radius/auth.c
@@ -443,8 +443,11 @@ int rad_auth_mschap_v1(struct radius_pd_t *rpd, const char *username, va_list ar
rpd->auth_req->pack->id++;
} else if (rpd->auth_req->reply) {
ra = rad_packet_find_attr(rpd->auth_req->reply, "Microsoft", "MS-CHAP-Error");
- if (ra)
- *mschap_error = ra->val.string;
+ if (ra) {
+ *mschap_error = _malloc(ra->len + 1);
+ memcpy(*mschap_error, ra->val.string, ra->len);
+ (*mschap_error)[ra->len] = 0;
+ }
}
out:
@@ -531,11 +534,17 @@ int rad_auth_mschap_v2(struct radius_pd_t *rpd, const char *username, va_list ar
rpd->auth_req->pack->id++;
} else if (rpd->auth_req->reply) {
ra = rad_packet_find_attr(rpd->auth_req->reply, "Microsoft", "MS-CHAP-Error");
- if (ra)
- *mschap_error = ra->val.string;
+ if (ra) {
+ *mschap_error = _malloc(ra->len + 1);
+ memcpy(*mschap_error, ra->val.string, ra->len);
+ (*mschap_error)[ra->len] = 0;
+ }
ra = rad_packet_find_attr(rpd->auth_req->reply, NULL, "Reply-Message");
- if (ra)
- *reply_msg = ra->val.string;
+ if (ra) {
+ *reply_msg = _malloc(ra->len + 1);
+ memcpy(*reply_msg, ra->val.string, ra->len);
+ (*reply_msg)[ra->len] = 0;
+ }
}
out: