From ef38b4c55e9781499a5a4e01cebcf4c1d11dc9b8 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 20 Nov 2018 10:25:53 +0100 Subject: 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 --- src/gprs/sgsn_vty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c index 0147b856c..c01de3b65 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", -- cgit v1.2.3