From 0ea6e01c9b26f89d7f1ffecfd2ad2e9b30a0824d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 17 May 2021 14:29:35 +0200 Subject: libmm-glib,location-3gpp: fix string overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mm-location-3gpp.c: In function ‘mm_location_3gpp_get_mobile_country_code’: mm-location-3gpp.c:139:12: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 139 | mcc[4] = '\0'; | ~~~~~~~^~~~~~ mm-location-3gpp.c:132:11: note: at offset 4 to object ‘mcc’ with size 4 declared here 132 | gchar mcc[4]; | ^~~ --- libmm-glib/mm-location-3gpp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmm-glib/mm-location-3gpp.c') diff --git a/libmm-glib/mm-location-3gpp.c b/libmm-glib/mm-location-3gpp.c index 92e20f11..30429e56 100644 --- a/libmm-glib/mm-location-3gpp.c +++ b/libmm-glib/mm-location-3gpp.c @@ -136,7 +136,7 @@ mm_location_3gpp_get_mobile_country_code (MMLocation3gpp *self) if (!self->priv->operator_code) return 0; memcpy (mcc, self->priv->operator_code, 3); - mcc[4] = '\0'; + mcc[3] = '\0'; return strtol (mcc, NULL, 10); } -- cgit v1.2.3-70-g09d2