This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13769 ) Change subject: common/paging.c: fix unaligned pointer access ...................................................................... common/paging.c: fix unaligned pointer access Passing a pointer to a packed structure to tmsi_mi_to_uint() may result in unaligned pointer value. Found with clang-8. Change-Id: Ief69854973a098e6da7c05f4417dc11988edd777 --- M src/common/paging.c 1 file changed, 22 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/src/common/paging.c b/src/common/paging.c index aa604e7..111f947 100644 --- a/src/common/paging.c +++ b/src/common/paging.c @@ -302,7 +302,9 @@ uint8_t cneed2, const uint8_t *identity3_lv) { struct gsm48_paging2 *pt2 = (struct gsm48_paging2 *) out_buf; + uint32_t tmsi; uint8_t *cur; + int rc; memset(out_buf, 0, sizeof(*pt2)); @@ -311,8 +313,12 @@ pt2->pag_mode = GSM48_PM_NORMAL; pt2->cneed1 = cneed1; pt2->cneed2 = cneed2; - tmsi_mi_to_uint(&pt2->tmsi1, tmsi1_lv); - tmsi_mi_to_uint(&pt2->tmsi2, tmsi2_lv); + rc = tmsi_mi_to_uint(&tmsi, tmsi1_lv); + if (rc == 0) + pt2->tmsi1 = tmsi; + rc = tmsi_mi_to_uint(&tmsi, tmsi2_lv); + if (rc == 0) + pt2->tmsi2 = tmsi; cur = out_buf + sizeof(*pt2); if (identity3_lv) @@ -329,6 +335,8 @@ const uint8_t *tmsi4_lv, uint8_t cneed4) { struct gsm48_paging3 *pt3 = (struct gsm48_paging3 *) out_buf; + uint32_t tmsi; + int rc; memset(out_buf, 0, sizeof(*pt3)); @@ -337,10 +345,18 @@ pt3->pag_mode = GSM48_PM_NORMAL; pt3->cneed1 = cneed1; pt3->cneed2 = cneed2; - tmsi_mi_to_uint(&pt3->tmsi1, tmsi1_lv); - tmsi_mi_to_uint(&pt3->tmsi2, tmsi2_lv); - tmsi_mi_to_uint(&pt3->tmsi3, tmsi3_lv); - tmsi_mi_to_uint(&pt3->tmsi4, tmsi4_lv); + rc = tmsi_mi_to_uint(&tmsi, tmsi1_lv); + if (rc == 0) + pt3->tmsi1 = tmsi; + rc = tmsi_mi_to_uint(&tmsi, tmsi2_lv); + if (rc == 0) + pt3->tmsi2 = tmsi; + rc = tmsi_mi_to_uint(&tmsi, tmsi3_lv); + if (rc == 0) + pt3->tmsi3 = tmsi; + rc = tmsi_mi_to_uint(&tmsi, tmsi4_lv); + if (rc == 0) + pt3->tmsi4 = tmsi; /* The structure definition in libosmocore is wrong. It includes as last * byte some invalid definition of chneed3/chneed4, so we must do this by hand -- To view, visit https://gerrit.osmocom.org/13769 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ief69854973a098e6da7c05f4417dc11988edd777 Gerrit-Change-Number: 13769 Gerrit-PatchSet: 2 Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190425/8029dd9f/attachment.htm>