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
This commit is contained in:
parent
13af4d7ec5
commit
1152362b51
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue