]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RADIUS DAS: Verify that Error-Code attribute is added
authorJouni Malinen <j@w1.fi>
Sun, 19 Aug 2012 15:32:35 +0000 (18:32 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 19 Aug 2012 15:32:35 +0000 (18:32 +0300)
Signed-hostap: Jouni Malinen <j@w1.fi>

src/radius/radius_das.c

index 8ecfffc9705051e649ec3ea8dcc563e3bdd7eec8..bded96519929e18c1c83de2f7776623ed931a167 100644 (file)
@@ -127,8 +127,11 @@ fail:
                return NULL;
 
        if (error) {
-               radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE,
-                                         error);
+               if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE,
+                                              error)) {
+                       radius_msg_free(reply);
+                       return NULL;
+               }
        }
 
        return reply;
@@ -225,7 +228,12 @@ static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx)
                        break;
 
                /* Unsupported Service */
-               radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE, 405);
+               if (!radius_msg_add_attr_int32(reply, RADIUS_ATTR_ERROR_CAUSE,
+                                              405)) {
+                       radius_msg_free(reply);
+                       reply = NULL;
+                       break;
+               }
                break;
        default:
                wpa_printf(MSG_DEBUG, "DAS: Unexpected RADIUS code %u in "