From f5f41e805195c8c3294a9e6a68b10f975fbabbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Neira=20Ayuso?= Date: Tue, 20 May 2014 09:06:53 +0200 Subject: sysmobts: Do not access out of bound string One can either use "strlen(str) + 1" but not add one to the result of the sizeof. --- src/osmo-bts-sysmo/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c index 1fa57960..b50b5cdb 100644 --- a/src/osmo-bts-sysmo/utils.c +++ b/src/osmo-bts-sysmo/utils.c @@ -245,13 +245,13 @@ int check_oml_msg(struct msgb *msg) if (omh->mdisc == ABIS_OM_MDISC_MANUF) { strncpy(label_id, (const char *) msg->l3h + 1, - sizeof(ipaccess_magic) + 1); + sizeof(ipaccess_magic)); if (strncmp(ipaccess_magic, label_id, - sizeof(ipaccess_magic) + 1) == 0) + sizeof(ipaccess_magic)) == 0) msg->l3h = msg->l3h + sizeof(ipaccess_magic) + 1; else if (strncmp(osmocom_magic, label_id, - sizeof(osmocom_magic) + 1) == 0) + sizeof(osmocom_magic)) == 0) msg->l3h = msg->l3h + sizeof(osmocom_magic) + 1; else { msg->l3h = NULL; -- cgit v1.2.3