lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

November 2026

  • 1 participants
  • 714 discussions
[M] Change in libosmocore[master]: gsm: fix one-byte overflow in BCD number encoders
by pespin 21 Nov '26

21 Nov '26
pespin has posted comments on this change by bucketking657. ( https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email ) Change subject: gsm: fix one-byte overflow in BCD number encoders ...................................................................... Patch Set 4: (1 comment) File src/gsm/gsm48_ie.c: https://gerrit.osmocom.org/c/libosmocore/+/44142/comment/7b05508c_9305b59f?… : PS2, Line 166: bcd_lv[0] = len; > Constraint and comment added in PS3 Done -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca Gerrit-Change-Number: 44142 Gerrit-PatchSet: 4 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Sat, 21 Nov 2026 20:56:55 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: bucketking657 <joshuashilts(a)gmail.com>
1 0
0 0
[M] Change in libosmocore[master]: gsm: fix one-byte overflow in BCD number encoders
by pespin 21 Nov '26

21 Nov '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email ) Change subject: gsm: fix one-byte overflow in BCD number encoders ...................................................................... gsm: fix one-byte overflow in BCD number encoders gsm48_encode_bcd_number() checked only the L octet against max_len, the size of bcd_lv, but it also writes the L octet itself, so a number one or two digits over the spec maximum wrote one byte past the buffer. Count the L octet in the check, and compute the length in an int so that it cannot wrap. Add tests. osmo-sgsn passes max_len 8 for the 9-byte IMEISV, which needs Change-Id Ied06aa05ee6850ec0df34a51cdce6df12e0b594c first. Fixes: OS#7126 Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca --- M src/gsm/gsm48_ie.c M tests/gsm0408/gsm0408_test.c M tests/gsm0408/gsm0408_test.ok M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 140 insertions(+), 3 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified jolly: Looks good to me, but someone else must approve diff --git a/src/gsm/gsm48_ie.c b/src/gsm/gsm48_ie.c index e33e672..866e0da 100644 --- a/src/gsm/gsm48_ie.c +++ b/src/gsm/gsm48_ie.c @@ -151,16 +151,22 @@ int h_len, const char *input) { int in_len = strlen(input); + int len; int i; uint8_t *bcd_cur = bcd_lv + 1 + h_len; /* two digits per byte, plus type byte */ - bcd_lv[0] = in_len/2 + h_len; + len = in_len/2 + h_len; if (in_len % 2) - bcd_lv[0]++; + len++; - if (bcd_lv[0] > max_len) + /* the L octet plus len octets must fit into bcd_lv */ + if (1 + len > max_len) return -EIO; + /* Lengths spanning multiple bytes cannot be encoded */ + if (len > 0xff) + return -EIO; + bcd_lv[0] = len; for (i = 0; i < in_len; i++) { int rc = asc_to_bcd(input[i]); diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c index 5566b7c..401d8e3 100644 --- a/tests/gsm0408/gsm0408_test.c +++ b/tests/gsm0408/gsm0408_test.c @@ -1496,6 +1496,28 @@ .enc_buf_lim = 9, }, { + .test_name = "16-digit number, fills the buffer (OS#7126)", + + /* Encoding test (L octet plus 8 octets) */ + .enc_ascii = "1234567890123456", + .enc_hex = "082143658709214365", + .enc_rc = 9, + + /* Buffer length limitations */ + .enc_buf_lim = 9, + }, + { + .test_name = "17-digit number, one octet over the buffer (OS#7126)", + + /* Encoding test (not enough room in buffer) */ + .enc_ascii = "12345678901234567", + .enc_hex = "", /* nothing */ + .enc_rc = -EIO, + + /* Buffer length limitations */ + .enc_buf_lim = 9, + }, + { .test_name = "LV incorrect length", .dec_hex = "05214365", /* should be 0x03 */ .dec_ascii = "(none)", @@ -1587,6 +1609,64 @@ printf("\n"); } +static void test_bcd_number_ie(const char *name, + int (*enc)(struct msgb *msg, const struct gsm_mncc_number *num), + unsigned int num_digits, bool octet_3a) +{ + struct gsm_mncc_number num = { .screen = octet_3a ? 1 : 0 }; + struct msgb *msg = msgb_alloc(128, __func__); + int rc; + + OSMO_ASSERT(msg); + OSMO_ASSERT(num_digits < sizeof(num.number)); + memset(num.number, '1', num_digits); + + rc = enc(msg, &num); + printf("- %s, %u digits%s: rc=%d IE='%s'\n", name, num_digits, + octet_3a ? " (with octet 3a)" : "", rc, + osmo_hexdump_nospc(msgb_data(msg), msgb_length(msg))); + + msgb_free(msg); +} + +/* OS#7126: neither the L octet nor the IE buffers may overflow */ +static void test_bcd_number_encode_limits(void) +{ + /* 508 digits fill buf exactly (L = 254), 509 need one octet more + * (L = 255), and 511 give L = 256, which must not wrap to 0 */ + static const unsigned int num_digits[] = { 508, 509, 511 }; + char digits[512]; + uint8_t buf[255]; + unsigned int i; + int rc; + + printf("BCD number encoding limits test\n"); + + for (i = 0; i < ARRAY_SIZE(num_digits); i++) { + memset(digits, '1', num_digits[i]); + digits[num_digits[i]] = '\0'; + rc = gsm48_encode_bcd_number(buf, sizeof(buf), 0, digits); + printf("- %u digits, max_len=%zu: rc=%d\n", num_digits[i], sizeof(buf), rc); + } + + /* TS 24.008 10.5.4.9: Calling party BCD number, at most 14 octets */ + test_bcd_number_ie("Calling", gsm48_encode_calling, 22, false); + test_bcd_number_ie("Calling", gsm48_encode_calling, 23, false); + test_bcd_number_ie("Calling", gsm48_encode_calling, 20, true); + test_bcd_number_ie("Calling", gsm48_encode_calling, 21, true); + /* TS 24.008 10.5.4.13: Connected number, at most 14 octets */ + test_bcd_number_ie("Connected", gsm48_encode_connected, 22, false); + test_bcd_number_ie("Connected", gsm48_encode_connected, 23, false); + /* TS 24.008 10.5.4.21b: Redirecting party BCD number, at most 19 octets */ + test_bcd_number_ie("Redirecting", gsm48_encode_redirecting, 32, false); + test_bcd_number_ie("Redirecting", gsm48_encode_redirecting, 30, true); + test_bcd_number_ie("Redirecting", gsm48_encode_redirecting, 31, true); + /* TS 24.008 10.5.4.7: Called party BCD number, limited by lv[18] */ + test_bcd_number_ie("Called", gsm48_encode_called, 32, false); + + printf("\n"); +} + struct { int range; int arfcns_num; @@ -2026,6 +2106,7 @@ test_mid_decode_zero_length(); test_struct_mobile_identity(); test_bcd_number_encode_decode(); + test_bcd_number_encode_limits(); test_ra_cap(); test_lai_encode_decode(); test_osmo_routing_area_id(); diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok index 3580591..ae2b0a5 100644 --- a/tests/gsm0408/gsm0408_test.ok +++ b/tests/gsm0408/gsm0408_test.ok @@ -229,6 +229,14 @@ - Decoding HEX (buffer limit=16) '0a21436587092143658709'... - Expected: (rc=-28) '123456789012345' - Actual: (rc=-28) '123456789012345' +- Running test: 16-digit number, fills the buffer (OS#7126) + - Encoding ASCII (buffer limit=9) '1234567890123456'... + - Expected: (rc=9) '082143658709214365' + - Actual: (rc=9) '082143658709214365' +- Running test: 17-digit number, one octet over the buffer (OS#7126) + - Encoding ASCII (buffer limit=9) '12345678901234567'... + - Expected: (rc=-5) '' + - Actual: (rc=-5) '' - Running test: LV incorrect length - Decoding HEX (buffer limit=0) '05214365'... - Expected: (rc=-22) '(none)' @@ -245,6 +253,21 @@ - Expected: (rc=-28) '123' - Actual: (rc=-28) '123' +BCD number encoding limits test +- 508 digits, max_len=255: rc=255 +- 509 digits, max_len=255: rc=-5 +- 511 digits, max_len=255: rc=-5 +- Calling, 22 digits: rc=0 IE='5c0c801111111111111111111111' +- Calling, 23 digits: rc=-5 IE='' +- Calling, 20 digits (with octet 3a): rc=0 IE='5c0c008111111111111111111111' +- Calling, 21 digits (with octet 3a): rc=-5 IE='' +- Connected, 22 digits: rc=0 IE='4c0c801111111111111111111111' +- Connected, 23 digits: rc=-5 IE='' +- Redirecting, 32 digits: rc=0 IE='74118011111111111111111111111111111111' +- Redirecting, 30 digits (with octet 3a): rc=0 IE='74110081111111111111111111111111111111' +- Redirecting, 31 digits (with octet 3a): rc=-5 IE='' +- Called, 32 digits: rc=0 IE='5e118011111111111111111111111111111111' + Constructed RA: 077-121-666-5 MCC+MNC in BCD: 70 17 21 diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c index 8ebbd4b..cafea50 100644 --- a/tests/gsm0808/gsm0808_test.c +++ b/tests/gsm0808/gsm0808_test.c @@ -477,6 +477,29 @@ OSMO_ASSERT(rc == 5); } +/* OS#7126: TS 48.008 3.2.2.101 allows at most 10 octets of MSISDN digits */ +static void test_gsm0808_enc_msisdn_limits(void) +{ + static const char *msisdns[] = { + "12345678901234567890", /* 20 digits, the maximum */ + "123456789012345678901", /* 21 digits, too long */ + }; + unsigned int i; + + printf("Testing encoding MSISDN length limits\n"); + + for (i = 0; i < ARRAY_SIZE(msisdns); i++) { + struct msgb *msg = msgb_alloc(64, __func__); + uint8_t rc; + + OSMO_ASSERT(msg); + rc = gsm0808_enc_msisdn(msg, msisdns[i]); + printf("- %zu digits: rc=%u IE='%s'\n", strlen(msisdns[i]), rc, + osmo_hexdump_nospc(msgb_data(msg), msgb_length(msg))); + msgb_free(msg); + } +} + static void test_create_ass(void) { static const uint8_t res1[] = @@ -2822,6 +2845,7 @@ test_dec_confusion(); test_dec_perform_location_report_sys5891(); + test_gsm0808_enc_msisdn_limits(); printf("Done\n"); return EXIT_SUCCESS; diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok index 2329fcd..b3d4cae 100644 --- a/tests/gsm0808/gsm0808_test.ok +++ b/tests/gsm0808/gsm0808_test.ok @@ -917,4 +917,7 @@ Diagnostics error bit location 15 (Reserved value) Diagnostics message that provoked the error: 00 03 25 03 25 Testing decoding Perform Location Report SYS#5891 +Testing encoding MSISDN length limits +- 20 digits: rc=12 IE='7b0a21436587092143658709' +- 21 digits: rc=0 IE='' Done -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca Gerrit-Change-Number: 44142 Gerrit-PatchSet: 4 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in libosmocore[master]: gsm: fix one-byte overflow in BCD number encoders
by pespin 21 Nov '26

21 Nov '26
Attention is currently required from: bucketking657, laforge. pespin has posted comments on this change by bucketking657. ( https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email ) Change subject: gsm: fix one-byte overflow in BCD number encoders ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca Gerrit-Change-Number: 44142 Gerrit-PatchSet: 3 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Sat, 21 Nov 2026 20:56:49 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-sgsn[master]: sgsn_libgtp: encode IMEISV via a local LV buffer
by pespin 21 Nov '26

21 Nov '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/44150?usp=email ) Change subject: sgsn_libgtp: encode IMEISV via a local LV buffer ...................................................................... sgsn_libgtp: encode IMEISV via a local LV buffer gsm48_encode_bcd_number() was called on pdp->imeisv.v with max_len 8, which only worked because it compares max_len against the L octet. A 16-digit IMEISV needs 9 bytes (L plus 8 octets). Encode into a local 9-byte LV buffer, check the return code, and copy the value part. Related: OS#7126 Change-Id: Ied06aa05ee6850ec0df34a51cdce6df12e0b594c --- M src/sgsn/sgsn_libgtp.c 1 file changed, 12 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c index b4c24a0..4573427 100644 --- a/src/sgsn/sgsn_libgtp.c +++ b/src/sgsn/sgsn_libgtp.c @@ -300,11 +300,18 @@ /* optional include the IMEI(SV) */ if (mmctx->imei[0] != '\0') { - memset(&pdp->imeisv.v[0], 0, 8); - pdp->imeisv_given = 1; - gsm48_encode_bcd_number(&pdp->imeisv.v[0], 8, 0, mmctx->imei); - pdp->imeisv.l = 8; - memmove(&pdp->imeisv.v[0], &pdp->imeisv.v[1], 8); + /* the L octet plus 8 octets of IMEI(SV) digits */ + uint8_t bcd_lv[9]; + + rc = gsm48_encode_bcd_number(bcd_lv, sizeof(bcd_lv), 0, mmctx->imei); + if (rc < 0) { + LOGPDPCTXP(LOGL_ERROR, pctx, "Cannot encode IMEI(SV) '%s'\n", mmctx->imei); + } else { + pdp->imeisv_given = 1; + pdp->imeisv.l = bcd_lv[0]; + OSMO_ASSERT(pdp->imeisv.l + 1 <= sizeof(bcd_lv)); + memcpy(&pdp->imeisv.v[0], &bcd_lv[1], pdp->imeisv.l); + } } /* change pdp state to 'requested' */ -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/44150?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ied06aa05ee6850ec0df34a51cdce6df12e0b594c Gerrit-Change-Number: 44150 Gerrit-PatchSet: 4 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in libosmocore[master]: gsm: fix one-byte overflow in BCD number encoders
by jolly 20 Nov '26

20 Nov '26
Attention is currently required from: bucketking657, laforge, pespin. jolly has posted comments on this change by bucketking657. ( https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email ) Change subject: gsm: fix one-byte overflow in BCD number encoders ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca Gerrit-Change-Number: 44142 Gerrit-PatchSet: 3 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Fri, 20 Nov 2026 20:25:41 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in libosmocore[master]: gsm: fix one-byte overflow in BCD number encoders
by bucketking657 20 Nov '26

20 Nov '26
Attention is currently required from: laforge, pespin. bucketking657 has posted comments on this change by bucketking657. ( https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email ) Change subject: gsm: fix one-byte overflow in BCD number encoders ...................................................................... Patch Set 3: (2 comments) File src/gsm/gsm48_ie.c: https://gerrit.osmocom.org/c/libosmocore/+/44142/comment/8149b71e_718c9cfd?… : PS1, Line 140: * \param[in] max_len Maximum value of the L octet; \a bcd_lv must have > Please rework the other patch as mentioned (feel free to improve my commnets as needed) and submit a […] Reworked patched pushed up in PS2 File src/gsm/gsm48_ie.c: https://gerrit.osmocom.org/c/libosmocore/+/44142/comment/a1354b44_d6b91a50?… : PS2, Line 166: bcd_lv[0] = len; > Please add an extra check here: […] Constraint and comment added in PS3 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca Gerrit-Change-Number: 44142 Gerrit-PatchSet: 3 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Fri, 20 Nov 2026 18:47:24 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: bucketking657 <joshuashilts(a)gmail.com>
1 0
0 0
[S] Change in osmo-sgsn[master]: sgsn_libgtp: encode IMEISV via a local LV buffer
by bucketking657 20 Nov '26

20 Nov '26
Attention is currently required from: laforge. bucketking657 has posted comments on this change by bucketking657. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/44150?usp=email ) Change subject: sgsn_libgtp: encode IMEISV via a local LV buffer ...................................................................... Patch Set 4: (1 comment) File src/sgsn/sgsn_libgtp.c: https://gerrit.osmocom.org/c/osmo-sgsn/+/44150/comment/5a366380_4b52499c?us… : PS3, Line 312: memcpy(&pdp->imeisv.v[0], &bcd_lv[1], pdp->imeisv.l); > Assert added in PS4 Marked as resolved. -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/44150?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ied06aa05ee6850ec0df34a51cdce6df12e0b594c Gerrit-Change-Number: 44150 Gerrit-PatchSet: 4 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Fri, 20 Nov 2026 18:25:57 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: bucketking657 <joshuashilts(a)gmail.com>
1 0
0 0
[M] Change in libosmocore[master]: gsm: fix one-byte overflow in BCD number encoders
by bucketking657 20 Nov '26

20 Nov '26
Attention is currently required from: bucketking657, laforge, pespin. Hello Jenkins Builder, fixeria, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review+1 by pespin, Verified+1 by Jenkins Builder Change subject: gsm: fix one-byte overflow in BCD number encoders ...................................................................... gsm: fix one-byte overflow in BCD number encoders gsm48_encode_bcd_number() checked only the L octet against max_len, the size of bcd_lv, but it also writes the L octet itself, so a number one or two digits over the spec maximum wrote one byte past the buffer. Count the L octet in the check, and compute the length in an int so that it cannot wrap. Add tests. osmo-sgsn passes max_len 8 for the 9-byte IMEISV, which needs Change-Id Ied06aa05ee6850ec0df34a51cdce6df12e0b594c first. Fixes: OS#7126 Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca --- M src/gsm/gsm48_ie.c M tests/gsm0408/gsm0408_test.c M tests/gsm0408/gsm0408_test.ok M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 140 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/42/44142/3 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44142?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I99521d30896f3d58ecfb28de290bce7e31388fca Gerrit-Change-Number: 44142 Gerrit-PatchSet: 3 Gerrit-Owner: bucketking657 <joshuashilts(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: bucketking657 <joshuashilts(a)gmail.com>
1 0
0 0
[S] Change in libosmocore[master]: cosmetic: osmo_io: Rename variable s/hdr/msghdr/
by pespin 20 Nov '26

20 Nov '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/44139?usp=email ) Change subject: cosmetic: osmo_io: Rename variable s/hdr/msghdr/ ...................................................................... cosmetic: osmo_io: Rename variable s/hdr/msghdr/ We use "msghdr" almost everywhere to refer to a struct iofd_msghdr, use it in iofd_msghdr_alloc(). This allows differentiating it from its own "struct msghdr hdr" subfield. Change-Id: Ie00defc144dbd8cd87029d701cc4fa2943c4452b --- M src/core/osmo_io.c 1 file changed, 11 insertions(+), 11 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index f14f03b..83f3c05 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -142,16 +142,16 @@ struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg, size_t cmsg_size) { - struct iofd_msghdr *hdr; + struct iofd_msghdr *msghdr; uint8_t idx, io_len; - hdr = talloc_zero_size(iofd, sizeof(struct iofd_msghdr) + cmsg_size); - if (!hdr) + msghdr = talloc_zero_size(iofd, sizeof(struct iofd_msghdr) + cmsg_size); + if (!msghdr) return NULL; - hdr->action = action; - hdr->iofd = iofd; + msghdr->action = action; + msghdr->iofd = iofd; /* Allocate the number of read buffers, configured by the user. Use msg as first buffer, if not NULL. * Only READ may have multiple buffers, because packets will only be written to the first buffer. */ @@ -159,23 +159,23 @@ for (idx = 0; idx < io_len; idx++) { if (msg) { talloc_steal(iofd, msg); - hdr->msg[idx] = msg; + msghdr->msg[idx] = msg; msg = NULL; } else { - hdr->msg[idx] = iofd_msgb_alloc(iofd); - if (!hdr->msg[idx]) + msghdr->msg[idx] = iofd_msgb_alloc(iofd); + if (!msghdr->msg[idx]) break; } } /* If at least one msgb is allocated, we can continue with only one msgb, instead of completely failing. */ if (idx == 0) { - talloc_free(hdr); + talloc_free(msghdr); return NULL; } - hdr->io_len = idx; + msghdr->io_len = idx; - return hdr; + return msghdr; } /*! Free the msghdr. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44139?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ie00defc144dbd8cd87029d701cc4fa2943c4452b Gerrit-Change-Number: 44139 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in libosmocore[master]: core: osmo_init_logging2(): Log talloc output through osmo_logging sy...
by pespin 20 Nov '26

20 Nov '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/44137?usp=email ) Change subject: core: osmo_init_logging2(): Log talloc output through osmo_logging system ...................................................................... core: osmo_init_logging2(): Log talloc output through osmo_logging system The logging functionality of talloc is mainly used to log warnings and errors about spotted problems. By default, the logging callback is NULL and hence nothing is printed. Set up the callback so we can print the problems spotted. Change-Id: Ibe85438616d731636579981cce3756922295f48a --- M src/core/application.c M src/pseudotalloc/pseudotalloc.c M src/pseudotalloc/talloc.h 3 files changed, 15 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved diff --git a/src/core/application.c b/src/core/application.c index bb89adb..e71f4e2 100644 --- a/src/core/application.c +++ b/src/core/application.c @@ -78,6 +78,7 @@ #include <unistd.h> #include <errno.h> #include <sys/stat.h> +#include <talloc.h> struct log_target *osmo_stderr_target; @@ -102,6 +103,11 @@ #endif } +static void log_talloc_cb(const char *message) +{ + LOGP(DLGLOBAL, LOGL_NOTICE, "%s", message); +} + /*! Initialize the osmocom logging framework * \param[in] log_info Array of available logging sub-systems * \returns 0 on success, -1 in case of error @@ -114,6 +120,7 @@ return osmo_init_logging2(NULL, log_info); } + int osmo_init_logging2(void *ctx, const struct log_info *log_info) { static int logging_initialized = 0; @@ -129,6 +136,8 @@ log_add_target(osmo_stderr_target); log_set_all_filter(osmo_stderr_target, 1); + + talloc_set_log_fn(log_talloc_cb); return 0; } diff --git a/src/pseudotalloc/pseudotalloc.c b/src/pseudotalloc/pseudotalloc.c index 895c6dd..86d2a08 100644 --- a/src/pseudotalloc/pseudotalloc.c +++ b/src/pseudotalloc/pseudotalloc.c @@ -117,3 +117,7 @@ vsnprintf(buf, 128, fmt, ap); return buf; } + +void talloc_set_log_fn(void (*log_fn)(const char *message)) +{ +} diff --git a/src/pseudotalloc/talloc.h b/src/pseudotalloc/talloc.h index 3893599..372e3fb 100644 --- a/src/pseudotalloc/talloc.h +++ b/src/pseudotalloc/talloc.h @@ -65,3 +65,5 @@ #define talloc_steal(ctx, ptr) _talloc_steal_loc((ctx), (ptr), __location__) void *_talloc_steal_loc(const void *new_ctx, const void *obj, const char *location); char *talloc_vasprintf(const void *t, const char *fmt, va_list ap); + +void talloc_set_log_fn(void (*log_fn)(const char *message)); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44137?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ibe85438616d731636579981cce3756922295f48a Gerrit-Change-Number: 44137 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • ...
  • 72
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.