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 uploaded this change for review. ( https://gerrit.osmocom.org/10303 Change subject: handover_fsm.c: Fix -Werror=format-security errors ...................................................................... handover_fsm.c: Fix -Werror=format-security errors When building with -Werror=format-security, such as our OBS builds, it fails like this: [ 118s] handover_fsm.c: In function 'parse_ho_request': [ 118s] handover_fsm.c:478:4: error: format not a string literal and no format arguments [-Werror=format-security] [ 118s] gsm0808_cell_id_name(&req->cell_id_serving)); [ 118s] ^~~~~~~~~~~~~~~~~~~~ [ 118s] handover_fsm.c:489:4: error: format not a string literal and no format arguments [-Werror=format-security] [ 118s] gsm0808_cell_id_name(&req->cell_id_target)); [ 118s] ^~~~~~~~~~~~~~~~~~~~ [ 120s] cc1: some warnings being treated as errors Let's make sure we don't call sprintf() and friends without a format string. In fact, if we only want to copy a string without extra formatting, use osmo_strlcpy() or OSMO_STRLCPY_ARRAY(). Change-Id: I56cff3618f012f6b019f4fca7e2768814487137a --- M src/osmo-bsc/handover_fsm.c 1 file changed, 2 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/03/10303/1 diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c index ec2a53d..c2f5c8b 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -474,8 +474,7 @@ } /* LOG_HO() also calls gsm0808_cell_id_name(), so to be able to use gsm0808_cell_id_name() in * logging without getting mixed up with those static buffers, store the result. */ - snprintf(req->cell_id_serving_name, sizeof(req->cell_id_serving_name), - gsm0808_cell_id_name(&req->cell_id_serving)); + OSMO_STRLCPY_ARRAY(req->cell_id_serving_name, gsm0808_cell_id_name(&req->cell_id_serving)); if (!(e = TLVP_GET(tp2, GSM0808_IE_CELL_IDENTIFIER))) { LOG_HO(conn, LOGL_ERROR, "Missing IE: Cell Identifier (Target)\n"); @@ -485,8 +484,7 @@ LOG_HO(conn, LOGL_ERROR, "Invalid IE: Cell Identifier (Target)\n"); return false; } - snprintf(req->cell_id_target_name, sizeof(req->cell_id_target_name), - gsm0808_cell_id_name(&req->cell_id_target)); + OSMO_STRLCPY_ARRAY(req->cell_id_target_name, gsm0808_cell_id_name(&req->cell_id_target)); if ((e = TLVP_GET(tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE))) { int timeslot; -- To view, visit https://gerrit.osmocom.org/10303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I56cff3618f012f6b019f4fca7e2768814487137a Gerrit-Change-Number: 10303 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte <laforge at gnumonks.org> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180801/7e215810/attachment.htm>