]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RADIUS: Use size_t instead of int for message attributes
authorJouni Malinen <j@w1.fi>
Sun, 22 Mar 2020 16:00:28 +0000 (18:00 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 22 Mar 2020 16:50:04 +0000 (18:50 +0200)
While RADIUS messages are limited to 4 kB, use size_t to avoid even a
theoretical overflow issue with 16-bit int.

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

index 07240ea2243d926f025a610ff06a9adb41ecfc1f..be16e27b9d7c30c0ab43f0dd50a6298fb106d48a 100644 (file)
@@ -609,7 +609,7 @@ static int radius_msg_add_attr_to_array(struct radius_msg *msg,
 {
        if (msg->attr_used >= msg->attr_size) {
                size_t *nattr_pos;
-               int nlen = msg->attr_size * 2;
+               size_t nlen = msg->attr_size * 2;
 
                nattr_pos = os_realloc_array(msg->attr_pos, nlen,
                                             sizeof(*msg->attr_pos));