Module: kamailio
Branch: master
Commit: 8860f244d2ad3587621b033374792a2daae7df22
URL:
https://github.com/kamailio/kamailio/commit/8860f244d2ad3587621b033374792a2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-11-22T09:56:12+01:00
jwt: trim read value for the key
- GH #3282
---
Modified: src/modules/jwt/jwt_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8860f244d2ad3587621b033374792a2…
Patch:
https://github.com/kamailio/kamailio/commit/8860f244d2ad3587621b033374792a2…
---
diff --git a/src/modules/jwt/jwt_mod.c b/src/modules/jwt/jwt_mod.c
index 233a0709e39..d533b88a152 100644
--- a/src/modules/jwt/jwt_mod.c
+++ b/src/modules/jwt/jwt_mod.c
@@ -31,6 +31,7 @@
#include "../../core/dprint.h"
#include "../../core/mod_fix.h"
#include "../../core/lvalue.h"
+#include "../../core/trim.h"
#include "../../core/kemi.h"
#include "../../core/parser/parse_param.h"
@@ -467,9 +468,10 @@ static int ki_jwt_verify(sip_msg_t* msg, str *key, str *alg, str
*claims,
LM_ERR("unable to read key file content: %s\n", key->s);
goto error;
}
- keybuf[keybuf_len] = '\0';
kdata.s = (char*)keybuf;
kdata.len = (int)keybuf_len;
+ trim(&kdata);
+ kdata.s[keybuf_len] = '\0';
jwt_fcache_add(key, &kdata);
}
sparams = dupclaims;