Module: kamailio Branch: master Commit: 9ddf96759a14820bca0ed217892f60f01a0be9ba URL: https://github.com/kamailio/kamailio/commit/9ddf96759a14820bca0ed217892f60f01a0be9ba
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-05-03T10:09:41+02:00 core: added params check for b58_decode() --- Modified: src/core/basex.c --- Diff: https://github.com/kamailio/kamailio/commit/9ddf96759a14820bca0ed217892f60f01a0be9ba.diff Patch: https://github.com/kamailio/kamailio/commit/9ddf96759a14820bca0ed217892f60f01a0be9ba.patch --- diff --git a/src/core/basex.c b/src/core/basex.c index d30353f5e39..bbe4d7ceab2 100644 --- a/src/core/basex.c +++ b/src/core/basex.c @@ -338,18 +338,28 @@ static const char _sr_b58digits[] = */ char *b58_decode(char *outb, int *outbszp, char *b58, int b58sz) { - size_t outbsz = *outbszp - 1 /* save space for ending 0 */; + size_t outbsz; const unsigned char *b58u = (void *)b58; unsigned char *outu = (void *)outb; - size_t outisz = (outbsz + 3) / 4; - uint32_t outi[outisz]; + size_t outisz; uint64_t t; uint32_t c; size_t i, j; - uint8_t bytesleft = outbsz % 4; - uint32_t zeromask = bytesleft ? (0xffffffff << (bytesleft * 8)) : 0; + uint8_t bytesleft; + uint32_t zeromask; unsigned zerocount = 0; + if(outb == NULL || outbszp == NULL || b58 == NULL || *outbszp <= 1) { + LM_ERR("invalid output buffer for base58 decode\n"); + return NULL; + } + + outbsz = *outbszp - 1 /* save space for ending 0 */; + outisz = (outbsz + 3) / 4; + uint32_t outi[outisz]; + bytesleft = outbsz % 4; + zeromask = bytesleft ? (0xffffffff << (bytesleft * 8)) : 0; + if(!b58sz) b58sz = strlen(b58); _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
