aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-11-20 10:25:53 +0100
committerHarald Welte <laforge@gnumonks.org>2019-05-12 10:35:40 +0000
commitef38b4c55e9781499a5a4e01cebcf4c1d11dc9b8 (patch)
tree4e89a5011e85e0046eda672c35bb2ca4804b5fdc
parentdef0d941f9048aa7d82057640d7a8ecfab728832 (diff)
Fix IMSI padding in imsi-acl
In I73fd54ad3a4ab8be5aff0fee5c722597ad766e9d incorrect fix was added which only initialize first element of array. Fix this by using explicit index to initialize entire array. Change-Id: I26e4aa44f159d1b5b91dda4a586fd4e809711245
-rw-r--r--src/gprs/sgsn_vty.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 0147b85..c01de3b 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -636,12 +636,15 @@ DEFUN(imsi_acl, cfg_imsi_acl_cmd,
"Remove IMSI from ACL\n"
"IMSI of subscriber\n")
{
- char imsi_sanitized[GSM23003_IMSI_MAX_DIGITS + 1] = { '0' };
+ char imsi_sanitized[GSM23003_IMSI_MAX_DIGITS + 1];
const char *op = argv[0];
const char *imsi = imsi_sanitized;
size_t len = strnlen(argv[1], GSM23003_IMSI_MAX_DIGITS + 1);
int rc;
+ memset(imsi_sanitized, '0', GSM23003_IMSI_MAX_DIGITS);
+ imsi_sanitized[GSM23003_IMSI_MAX_DIGITS] = '\0';
+
/* Sanitize IMSI */
if (len > GSM23003_IMSI_MAX_DIGITS) {
vty_out(vty, "%% IMSI (%s) too long (max %u digits) -- ignored!%s",