Change in osmo-sgsn[master]: Fix IMSI padding in imsi-acl

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 12 10:35:40 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11838 )

Change subject: Fix IMSI padding in imsi-acl
......................................................................

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
---
M src/gprs/sgsn_vty.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
 	"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",

-- 
To view, visit https://gerrit.osmocom.org/11838
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I26e4aa44f159d1b5b91dda4a586fd4e809711245
Gerrit-Change-Number: 11838
Gerrit-PatchSet: 3
Gerrit-Owner: Max <suraev at alumni.ntnu.no>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190512/4e2ec7a4/attachment.html>


More information about the gerrit-log mailing list