]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add TEST_FAIL() to radius_msg_add_attr()
authorJouni Malinen <j@w1.fi>
Sun, 5 Mar 2017 14:36:24 +0000 (16:36 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 5 Mar 2017 14:37:52 +0000 (16:37 +0200)
This makes it easier to test error paths for RADIUS message
construction.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/radius/radius.c

index 9ddc19bbd3be1f8fed62824371f297edbb3d332b..69dbd48f9ddf4d212c5217aed4f887fbc848545d 100644 (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);