]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix WiMAX encoding bug introduced in 326a68b90a1a
authorAlan T. DeKok <aland@freeradius.org>
Thu, 12 Nov 2009 11:25:03 +0000 (12:25 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 14 Nov 2009 09:18:10 +0000 (10:18 +0100)
src/lib/radius.c

index 326ed52172373180dc1e8bef969a8ae4bf075d43..53333033e30d837a6038846d1608aee96c41198e 100644 (file)
@@ -852,14 +852,15 @@ static VALUE_PAIR *rad_vp2tlv(VALUE_PAIR *vps)
                }
 
                length = (end - ptr);
+               if (length > 255) return NULL;
 
                /*
                 *      Pack the attribute.
                 */
                ptr[0] = (vp->attribute & 0xff00) >> 8;
-               ptr[1] = (length & 0xff) + 2;
+               ptr[1] = length;
 
-               ptr += vp->length + 2;
+               ptr += ptr[1];
                vp->flags.encoded = 1;
        }