util_radius: radius only permits 253 octets
authorSam Hartman <hartmans@painless-security.com>
Fri, 11 Mar 2011 19:53:22 +0000 (14:53 -0500)
committerSam Hartman <hartmans@painless-security.com>
Fri, 11 Mar 2011 19:53:22 +0000 (14:53 -0500)
There is an off by one error because MAX_STR_LEN from freeradius has a pad byte.
Only store 253 bytes of AVP at a time.

util_radius.cpp

index 537150d..a680741 100644 (file)
@@ -479,8 +479,10 @@ gssEapRadiusAddAvp(OM_uint32 *minor,
         VALUE_PAIR *vp;
         size_t n = remain;
 
-        if (n > MAX_STRING_LEN)
-            n = MAX_STRING_LEN;
+       /*There's an extra byte of padding; RADIUS AVPS can only
+        * be 253 octets*/
+        if (n > MAX_STRING_LEN-1)
+            n = MAX_STRING_LEN-1;
 
         vp = paircreate(attrid, PW_TYPE_OCTETS);
         if (vp == NULL) {