Module: kamailio
Branch: master
Commit: 5a49de2a7d5623ca65c756468d22bef7ae50b439
URL: 
https://github.com/kamailio/kamailio/commit/5a49de2a7d5623ca65c756468d22bef7ae50b439

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-05-10T11:24:01+02:00

core: b58 decode compute output lenght from size

---

Modified: src/core/basex.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/5a49de2a7d5623ca65c756468d22bef7ae50b439.diff
Patch: 
https://github.com/kamailio/kamailio/commit/5a49de2a7d5623ca65c756468d22bef7ae50b439.patch

---

diff --git a/src/core/basex.c b/src/core/basex.c
index bbe4d7ceab2..3ffdeb4187f 100644
--- a/src/core/basex.c
+++ b/src/core/basex.c
@@ -363,7 +363,7 @@ char *b58_decode(char *outb, int *outbszp, char *b58, int 
b58sz)
        if(!b58sz)
                b58sz = strlen(b58);
 
-       outb[outbsz - 1] = '\0';
+       outb[outbsz] = '\0';
        memset(outi, 0, outisz * sizeof(*outi));
 
        /* leading zeros, just count */
@@ -420,9 +420,8 @@ char *b58_decode(char *outb, int *outbszp, char *b58, int 
b58sz)
        for(i = 0; i < outbsz; ++i) {
                if(outu[i])
                        break;
-               --*outbszp;
        }
-       *outbszp = strlen(outb + i);
+       *outbszp = (int)(outbsz - i);
 
        return outb + i;
 }

_______________________________________________
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!

Reply via email to