]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rlm_sigtran: fix wrong NAI odd/even bit mask and allocation off-by-one in sigtran_scc...
authorAlexander Bainbridge-Sedivy <alex.bainbridge@inkbridge.io>
Wed, 13 May 2026 14:13:19 +0000 (10:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 27 May 2026 20:22:24 +0000 (16:22 -0400)
src/modules/rlm_sigtran/sigtran.c

index f5f5ed82596bbfca6fb3614c757bc0c08b4ce2aa..802ca88bb941e816deffcff9a4e18085223eb39b 100644 (file)
@@ -181,7 +181,7 @@ int sigtran_sccp_global_title(TALLOC_CTX *ctx, uint8_t **out, int gt_ind, char c
         *      Nature of address indicator bit 8
         *      gets set high on odd number of digits.
         */
-       if (len & 0x01) nai |= 0xf0;
+       if (len & 0x01) nai |= 0x80;
 
        switch (gt_ind) {
        default:
@@ -200,13 +200,13 @@ int sigtran_sccp_global_title(TALLOC_CTX *ctx, uint8_t **out, int gt_ind, char c
                break;
 
        case SCCP_TITLE_IND_TRANS_NUM_ENC:
-               *out = p = talloc_array(ctx, uint8_t, (outlen + 3));
+               *out = p = talloc_array(ctx, uint8_t, (outlen + 2));
                (*p++) = tt;
                (*p++) = ((np & 0x0f) << 4) | (es & 0x0f);
                break;
 
        case SCCP_TITLE_IND_TRANS_NUM_ENC_NATURE:
-               *out = p = talloc_array(ctx, uint8_t, (outlen + 4));
+               *out = p = talloc_array(ctx, uint8_t, (outlen + 3));
                (*p++) = tt;
                (*p++) = ((np & 0x0f) << 4) | (es & 0x0f);
                (*p++) = nai;