diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-14 17:19:58 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-19 16:39:01 +0200 |
commit | a09b966cd487885ed81ee9da0476211ef3a8149e (patch) | |
tree | 32f879420d4dd7b43e65a2c650f71c71c64aee61 /openbsc/src/nat/bsc_nat.c | |
parent | e383980a7e39b25e3b16904581c879fb5a5b0e30 (diff) |
nat: Use strncmp on the string in case it is not null terminated
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r-- | openbsc/src/nat/bsc_nat.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index fc8b0a952..5403764f4 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -740,6 +740,7 @@ static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc { struct bsc_config *conf; const char *token = (const char *) TLVP_VAL(tvp, IPAC_IDTAG_UNITNAME); + const int len = TLVP_LEN(tvp, IPAC_IDTAG_UNITNAME); if (bsc->cfg) { LOGP(DNAT, LOGL_ERROR, "Reauth on fd %d bsc nr %d\n", @@ -748,7 +749,7 @@ static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc } llist_for_each_entry(conf, &bsc->nat->bsc_configs, entry) { - if (strcmp(conf->token, token) == 0) { + if (strncmp(conf->token, token, len) == 0) { rate_ctr_inc(&conf->stats.ctrg->ctr[BCFG_CTR_NET_RECONN]); bsc->authenticated = 1; bsc->cfg = conf; |