Skip to content

Commit

Permalink
Fix fr_value_box_cast_to_octets when dealing with non-numeric and non…
Browse files Browse the repository at this point in the history
…-ip types.
  • Loading branch information
arr2036 committed Dec 16, 2019
1 parent 44d8122 commit 0fe902a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/util/value.c
Original file line number Diff line number Diff line change
Expand Up @@ -1731,10 +1731,13 @@ static inline int fr_value_box_cast_to_octets(TALLOC_CTX *ctx, fr_value_box_t *d
*/
case FR_TYPE_NUMERIC:
fr_value_box_hton(dst, src); /* Flip any uint32 representations */
/* FALL-THROUGH */
bin = talloc_memdup(ctx, ((uint8_t const *)&dst->datum) + fr_value_box_offsets[src->type],
fr_value_box_field_sizes[src->type]);
break;

default:
bin = talloc_memdup(ctx, ((uint8_t *)&dst->datum) + fr_value_box_offsets[src->type],
/* Not the same talloc_memdup call as above. The above memdup reads data from the dst */
bin = talloc_memdup(ctx, ((uint8_t const *)&src->datum) + fr_value_box_offsets[src->type],
fr_value_box_field_sizes[src->type]);
break;
}
Expand Down

0 comments on commit 0fe902a

Please sign in to comment.