diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-01-13 03:10:54 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-01-23 11:59:01 +0000 |
commit | 59504dc80fe8c0d9a18994d82586a550c7efa341 (patch) | |
tree | 23f3f7906ad01337c44d862b929aed0257d55228 /openbsc/src/libcommon | |
parent | f5e74b5988cb6fb34a71188e70adc7b6c7fea28b (diff) |
fix strncpy() invocation in vty_interface_layer3.c and 3 tests
Use osmo_strlcpy() to fix unsafe invocation of strncpy(), which potentially
left the result unterminated.
Change-Id: I1a119b1760a3e3262538b4b012d476fdce505482
Diffstat (limited to 'openbsc/src/libcommon')
-rw-r--r-- | openbsc/src/libcommon/gsup_test_client.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openbsc/src/libcommon/gsup_test_client.c b/openbsc/src/libcommon/gsup_test_client.c index 1889c6fde..861212a64 100644 --- a/openbsc/src/libcommon/gsup_test_client.c +++ b/openbsc/src/libcommon/gsup_test_client.c @@ -7,6 +7,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/select.h> #include <osmocom/core/application.h> +#include <osmocom/core/utils.h> #include <osmocom/gsm/gsup.h> #include <openbsc/gsup_client.h> @@ -108,7 +109,7 @@ int req_auth_info(const char *imsi) struct osmo_gsup_message gsup = {0}; struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); - strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + osmo_strlcpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); gsup.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST; osmo_gsup_encode(msg, &gsup); @@ -123,7 +124,7 @@ int req_loc_upd(const char *imsi) struct osmo_gsup_message gsup = {0}; struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); - strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + osmo_strlcpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST; osmo_gsup_encode(msg, &gsup); @@ -136,7 +137,7 @@ int resp_isd(struct imsi_op *io) struct osmo_gsup_message gsup = {0}; struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__); - strncpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); + osmo_strlcpy(gsup.imsi, io->imsi, sizeof(gsup.imsi)); gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_RESULT; osmo_gsup_encode(msg, &gsup); |