Skip to content

Commit

Permalink
Add NULL check in originate-coa
Browse files Browse the repository at this point in the history
This prevents segfaults that may occur when the COA list could not be created, either by a lack of memory, or a request that is not an Access-Request/Accounting-Request
  • Loading branch information
qnet-herwin authored and arr2036 committed Jul 22, 2015
1 parent 0e33d2e commit 473a5f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,10 @@ int map_to_request(REQUEST *request, vp_map_t const *map, radius_map_getvalue_t
*/
if (((map->lhs->tmpl_list == PAIR_LIST_COA) ||
(map->lhs->tmpl_list == PAIR_LIST_DM)) && !request->coa) {
request_alloc_coa(context);
if (!request_alloc_coa(context)) {
REDEBUG("Failed to create a CoA/Disconnect Request message");
return -2;
}
context->coa->proxy->code = (map->lhs->tmpl_list == PAIR_LIST_COA) ?
PW_CODE_COA_REQUEST :
PW_CODE_DISCONNECT_REQUEST;
Expand Down

0 comments on commit 473a5f7

Please sign in to comment.