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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18490 )
Change subject: fix osmo_mi_name_c() to always return talloced strings, via osmo_mi_name_buf()
......................................................................
fix osmo_mi_name_c() to always return talloced strings, via osmo_mi_name_buf()
Fix osmo_mi_name_buf() to snprintf() into the buf in *all* cases.
osmo_mi_name_c() is implemented via osmo_mi_name_buf(), which returns
compile-time string constants in special cases. That means that
osmo_mi_name_c() does return non-allocated strings in these special cases.
The caller of functions like osmo_mi_name_c() must always be able to rely on
getting a talloced string, or run a danger of deallocating const pointers.
Change-Id: I623959f01b72642bcdd18508097c5c405c59f6f1
---
M src/gsm/gsm48.c
1 file changed, 5 insertions(+), 3 deletions(-)
Approvals:
fixeria: Looks good to me, approved
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 43b10b7..8d0998b 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -479,9 +479,10 @@
if (mi_len == GSM48_TMSI_LEN && mi[0] == (0xf0 | GSM_MI_TYPE_TMSI)) {
tmsi = osmo_load32be(&mi[1]);
snprintf(buf, buf_len, "TMSI-0x%08" PRIX32, tmsi);
- return buf;
+ } else {
+ snprintf(buf, buf_len, "TMSI-invalid");
}
- return "TMSI-invalid";
+ return buf;
case GSM_MI_TYPE_IMSI:
case GSM_MI_TYPE_IMEI:
@@ -491,7 +492,8 @@
return buf;
default:
- return "unknown";
+ snprintf(buf, buf_len, "unknown");
+ return buf;
}
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18490
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I623959f01b72642bcdd18508097c5c405c59f6f1
Gerrit-Change-Number: 18490
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200527/61852573/attachment.htm>