Skip to content

Commit

Permalink
In theory if the option number were 0 we'd dereference uninitialised …
Browse files Browse the repository at this point in the history
…memory
  • Loading branch information
arr2036 committed Mar 21, 2014
1 parent 01ea675 commit 58d7eac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/proto_dhcp/dhcp.c
Expand Up @@ -1064,7 +1064,12 @@ static VALUE_PAIR *fr_dhcp_vp2suboption(TALLOC_CTX *ctx, vp_cursor_t *cursor)
for (vp = fr_cursor_current(&to_pack);
vp && vp->da->flags.is_tlv && !vp->da->flags.extended && (SUBOPTION_PARENT(vp->da->attr) == parent);
vp = fr_cursor_next(&to_pack)) {
/* Don't write out the header, were packing array options */
if (SUBOPTION_ATTR(vp->da->attr) == 0) {
fr_strerror_printf("Invalid attribute number 0");
return NULL;
}

/* Don't write out the header, were packing array options */
if (!vp->da->flags.array || (attr != SUBOPTION_ATTR(vp->da->attr))) {
attr = SUBOPTION_ATTR(vp->da->attr);
*p++ = attr;
Expand Down

0 comments on commit 58d7eac

Please sign in to comment.