Skip to content

Commit

Permalink
Encrypted attrs can only be for old-style attrs.
Browse files Browse the repository at this point in the history
Closes CID #1035573
  • Loading branch information
alandekok committed Mar 25, 2014
1 parent 058ba66 commit ca8251c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/lib/radius.c
Expand Up @@ -3461,12 +3461,17 @@ static ssize_t data2vp(RADIUS_PACKET *packet,
* Decrypt the attribute.
*/
if (secret && packet && (da->flags.encrypt != FLAG_ENCRYPT_NONE)) {
/*
* Encrypted attributes can only exist for the
* old-style format. Extended attributes CANNOT
* be encrypted.
*/
if (attrlen > 253) {
return -1;
}

if (data == start) {
if (attrlen < sizeof(buffer)) {
memcpy(buffer, data, attrlen);
} else {
memcpy(buffer, data, sizeof(buffer));
}
memcpy(buffer, data, attrlen);
}
data = buffer;

Expand Down

0 comments on commit ca8251c

Please sign in to comment.