server: Don't accept out-of-range bank/client/slot numbers on REST

Change-Id: Id0c9dcda58d1f85df431a74bbfba06cfaa0af69d
This commit is contained in:
Harald Welte 2020-02-20 18:45:59 +01:00
parent 44866d501b
commit f43babac56
1 changed files with 4 additions and 0 deletions

View File

@ -86,6 +86,8 @@ static int json2bank_slot(struct bank_slot *bslot, json_t *in)
return -EINVAL;
bslot->bank_id = json_integer_value(jbank_id);
bslot->slot_nr = json_integer_value(jslot_nr);
if (bslot->bank_id > 1023 || bslot->slot_nr > 1023)
return -EINVAL;
return 0;
}
@ -110,6 +112,8 @@ static int json2client_slot(struct client_slot *cslot, json_t *in)
return -EINVAL;
cslot->client_id = json_integer_value(jclient_id);
cslot->slot_nr = json_integer_value(jslot_nr);
if (cslot->client_id > 1023 || cslot->slot_nr > 1023)
return -EINVAL;
return 0;
}