diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-11-26 00:01:53 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-11-26 00:04:44 +0100 |
commit | e08cdd92a648ea8d9bb6ca405f04c91ca485db3c (patch) | |
tree | 68c3f6704320eceee60ef3e4f0c60065d384db90 /src | |
parent | 5ee050c1e7fde4e32e3334e7bf02c4f663474d55 (diff) |
ue_context_alloc(): Avoid ue->imsi without NULL termination
Change-Id: I152e84206e0b2b80fa79956f5adbbe84ff10b4ab
Fixes: Coverity CID 57625
Diffstat (limited to 'src')
-rw-r--r-- | src/hnbgw.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hnbgw.c b/src/hnbgw.c index acca643..9984927 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -163,9 +163,10 @@ struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi, return NULL; ue->hnb = hnb; - if (imsi) + if (imsi) { strncpy(ue->imsi, imsi, sizeof(ue->imsi)); - else + ue->imsi[sizeof(ue->imsi)-1] = '\0'; + } else ue->imsi[0] = '\0'; ue->tmsi = tmsi; ue->context_id = get_next_ue_ctx_id(hnb->gw); |