]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
:gear: dhcpv4: Fix wrong memory context
authorJorge Pereira <jpereiran@gmail.com>
Wed, 7 Oct 2020 01:26:18 +0000 (22:26 -0300)
committerAlan DeKok <aland@freeradius.org>
Wed, 7 Oct 2020 12:17:21 +0000 (08:17 -0400)
It must be the received ctx instead of local allocation.

src/protocols/dhcpv4/decode.c

index b93285db24de17e8986f698bf447c827687c5968..8cd17d0118b131372eb70e685bee3e1f4c2b322c 100644 (file)
@@ -522,7 +522,6 @@ static int decode_test_ctx(void **out, TALLOC_CTX *ctx)
 static ssize_t fr_dhcpv4_decode_proto(TALLOC_CTX *ctx, VALUE_PAIR **vps, uint8_t const *data, size_t data_len, UNUSED void *proto_ctx)
 {
        ssize_t rcode;
-//     fr_dhcpv4_ctx_t *test_ctx = talloc_get_type_abort(proto_ctx, fr_dhcpv4_ctx_t);
        RADIUS_PACKET *packet;
 
        if (!fr_dhcpv4_ok(data, data_len, NULL, NULL)) return -1;
@@ -532,7 +531,7 @@ static ssize_t fr_dhcpv4_decode_proto(TALLOC_CTX *ctx, VALUE_PAIR **vps, uint8_t
 
        memcpy(&packet->data, &data, sizeof(packet->data)); /* const issues */
        packet->data_len = data_len;
-       rcode = fr_dhcpv4_decode(packet, packet->data, packet->data_len, &packet->vps, &packet->code);
+       rcode = fr_dhcpv4_decode(ctx, packet->data, packet->data_len, &packet->vps, &packet->code);
 
        (void) fr_pair_list_copy(ctx, vps, packet->vps);
        talloc_free(packet);