]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/cookies/alg_sha.c: replace asserts
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 24 Mar 2021 16:44:44 +0000 (17:44 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 25 May 2021 12:39:40 +0000 (14:39 +0200)
lib/cookies/alg_sha.c

index 37eafbc5119dad44be5e65dee62b1e21b1597ea1..5c5da495ee868fdd487e2960f58e6b04b371d345 100644 (file)
@@ -2,7 +2,6 @@
  *  SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include <assert.h>
 #include <nettle/hmac.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -22,7 +21,8 @@
 static inline void update_hash(struct hmac_sha256_ctx *ctx,
                                const struct sockaddr *sa)
 {
-       assert(ctx && sa);
+       if (!kr_assume(ctx && sa))
+               return;
 
        int addr_len = kr_inaddr_len(sa);
        const uint8_t *addr = (uint8_t *)kr_inaddr(sa);