diff options
author | Álvaro Neira Ayuso <anayuso@sysmocom.de> | 2014-05-20 09:06:53 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-05-20 09:43:38 +0200 |
commit | f5f41e805195c8c3294a9e6a68b10f975fbabbbd (patch) | |
tree | beb9572220a6b21877bb55d594b893368ba1ba57 /src/osmo-bts-sysmo/utils.c | |
parent | 13a224063dfcee0be529fba1c8fb9be9c1fb261e (diff) |
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.
Diffstat (limited to 'src/osmo-bts-sysmo/utils.c')
-rw-r--r-- | src/osmo-bts-sysmo/utils.c | 6 |
1 files 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; |