]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
original can be NULL
authorAlan T. DeKok <aland@freeradius.org>
Tue, 3 Mar 2020 15:39:17 +0000 (10:39 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 3 Mar 2020 19:23:24 +0000 (14:23 -0500)
and if so, use packet vector as the decoding vector.

This changes makes the API easier to understand

src/protocols/radius/base.c
src/protocols/radius/radius.h

index 740f44f646f06225f95e5014987e969c3fb0cb14..2611793135c90ab4d2079c380f683e108a1ea989 100644 (file)
@@ -1067,7 +1067,7 @@ ssize_t   fr_radius_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
 
        packet_ctx.tmp_ctx = talloc_init("tmp");
        packet_ctx.secret = secret;
-       packet_ctx.vector = original + 4;
+       packet_ctx.vector = original ? original + 4 : packet + 4;
 
        fr_cursor_init(&cursor, vps);
 
index 0138cad385e6631b0da9cc12cdff34c00abc7e78..8b87f9afb16a3f02e3a91e3a0a6a0d0add849bc3 100644 (file)
@@ -107,7 +107,7 @@ ssize_t             fr_radius_encode(uint8_t *packet, size_t packet_len, uint8_t const *ori
                                 char const *secret, UNUSED size_t secret_len, int code, int id, VALUE_PAIR *vps);
 
 ssize_t                fr_radius_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, uint8_t const *original,
-                                char const *secret, UNUSED size_t secret_len, VALUE_PAIR **vps) CC_HINT(nonnull);
+                                char const *secret, UNUSED size_t secret_len, VALUE_PAIR **vps) CC_HINT(nonnull(1,2,5,7));
 
 int            fr_radius_init(void);