/*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
{
gss_eap_attr_ctx::registerProvider(ATTR_TYPE_RADIUS,
"urn:ietf:params:gss-eap:radius-avp",
- gss_eap_radius_attr_provider::createAttrContext);
+ createAttrContext);
return true;
}
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)
+ n = MAX_STRING_LEN - 1;
vp = paircreate(attrid, PW_TYPE_OCTETS);
if (vp == NULL) {
remain -= 5;
break;
case PW_TYPE_STRING:
- /* check enough room to NUL terminate */
- if (p[0] == MAX_STRING_LEN)
- goto fail;
- else
- /* fallthrough */
default:
- if (p[0] > MAX_STRING_LEN)
+ if (p[0] >= MAX_STRING_LEN)
goto fail;
vp->length = (uint32_t)p[0];
*minor = ERROR_TABLE_BASE_rse + code;
- gssEapSaveStatusInfo(*minor, "%s", rs_err_msg(err, 0));
+ gssEapSaveStatusInfo(*minor, "%s", rs_err_msg(err));
rs_err_free(err);
return GSS_S_FAILURE;