aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/handover_fsm.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-08-01 18:35:34 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-01 18:35:34 +0200
commit1152362b515444bf236801a87917e9979d468e70 (patch)
tree17ea5f95878ba98ad39293d37a3b49d18db85d0f /src/osmo-bsc/handover_fsm.c
parent13af4d7ec5ffde8949be7fbd60c06e637d089b17 (diff)
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
Diffstat (limited to 'src/osmo-bsc/handover_fsm.c')
-rw-r--r--src/osmo-bsc/handover_fsm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index ec2a53d2d..c2f5c8bfe 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -474,8 +474,7 @@ static bool parse_ho_request(struct gsm_subscriber_connection *conn, const struc
}
/* 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 @@ static bool parse_ho_request(struct gsm_subscriber_connection *conn, const struc
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;