Module: kamailio
Branch: master
Commit: 4ffdd10c21deae49dd506ac1ffce67b6b30a7c30
URL: 
https://github.com/kamailio/kamailio/commit/4ffdd10c21deae49dd506ac1ffce67b6b30a7c30

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-06-29T11:47:15+02:00

crypto: hex conversion for uuid generation

---

Modified: src/modules/crypto/crypto_uuid.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/4ffdd10c21deae49dd506ac1ffce67b6b30a7c30.diff
Patch: 
https://github.com/kamailio/kamailio/commit/4ffdd10c21deae49dd506ac1ffce67b6b30a7c30.patch

---

diff --git a/src/modules/crypto/crypto_uuid.c b/src/modules/crypto/crypto_uuid.c
index 6be44b184da..19009273a4a 100644
--- a/src/modules/crypto/crypto_uuid.c
+++ b/src/modules/crypto/crypto_uuid.c
@@ -72,7 +72,7 @@ static inline int crypto_bytes2hex(
        if(sbuf_len < 2 * buf_len)
                return -1;
        for(i = 0, j = (2 * buf_len) - 1; i < sbuf_len; i++, j--) {
-               sbuf[i] = crypto_byte2hex((buf[j / 2] >> (j % 2 ? 0 : 4)) % 
0x0f);
+               sbuf[i] = crypto_byte2hex((buf[j / 2] >> (j % 2 ? 0 : 4)) & 
0x0f);
                if(j == 0)
                        break;
        }
@@ -158,7 +158,7 @@ static inline int crypto_format_rfc4122_uuid(
                        sbuf[i] = '-';
                        continue;
                }
-               sbuf[i] = crypto_byte2hex((buf[j / 2] >> (j % 2 ? 0 : 4)) % 
0x0f);
+               sbuf[i] = crypto_byte2hex((buf[j / 2] >> (j % 2 ? 0 : 4)) & 
0x0f);
                if(!(++j / 2 < buf_len))
                        break;
        }

_______________________________________________
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