aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-10-06 16:18:07 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-10-06 16:28:59 +0200
commitcf10ad5c11764ae83b00ac8c57fa4985045daadb (patch)
tree2e2bf6d49b24a751cb4f53de7336c9c32a7765e1
parentfda1fed7c88549030523350c0a3f337e49bbf868 (diff)
downloadslcl-cf10ad5c11764ae83b00ac8c57fa4985045daadb.tar.gz
jwt.c: Do not consider decoding errors as fatals
The base64 string is considered untrusted input and, therefore, it might cause a decoding error. Therefore, this should not cause the server to close.
-rw-r--r--jwt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/jwt.c b/jwt.c
index 2587b91..94f2f6e 100644
--- a/jwt.c
+++ b/jwt.c
@@ -137,7 +137,7 @@ int jwt_check(const char *const jwt, const void *const key, const size_t n)
else if (!(dhmac = base64_decode(p + 1, &hmaclen)))
{
fprintf(stderr, "%s: base64_decode failed\n", __func__);
- return -1;
+ return 1;
}
const int r = memcmp(dhmac, hmac, hmaclen);