tests: Add TEST_FAIL() to radius_msg_add_attr()

This makes it easier to test error paths for RADIUS message
construction.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-03-05 16:36:24 +02:00
parent de01f254a6
commit b9fd3c244e

View file

@ -631,6 +631,9 @@ struct radius_attr_hdr *radius_msg_add_attr(struct radius_msg *msg, u8 type,
size_t buf_needed;
struct radius_attr_hdr *attr;
if (TEST_FAIL())
return NULL;
if (data_len > RADIUS_MAX_ATTR_LEN) {
wpa_printf(MSG_ERROR, "radius_msg_add_attr: too long attribute (%lu bytes)",
(unsigned long) data_len);