Blame SOURCES/0001-hostname-helper-don-t-read-past-0.patch

57bc60
From 96976105f3dc50bdc75cd23b5d163373a6c4d02f Mon Sep 17 00:00:00 2001
57bc60
From: Mohammed Sadiq <sadiq@sadiqpk.org>
57bc60
Date: Fri, 5 May 2017 17:40:33 +0530
57bc60
Subject: [PATCH 1/3] hostname-helper: don't read past '\0'
57bc60
57bc60
g_utf8_find_next_char() doesn't do checks whether the char
57bc60
is '\0' or not. We have to take care of that ourself.
57bc60
57bc60
This commit fixes heap-buffer-overflow found by test-hostname
57bc60
57bc60
ERROR: AddressSanitizer: heap-buffer-overflow on address
57bc60
READ of size 1 at 0x60200000cd76 thread T0
57bc60
 #0 0x7f8b26920d08 in g_utf8_find_next_char glib/glib/gutf8.c:179
57bc60
 #1 0x55c2b8eacaee in pretty_hostname_to_ssid gnome-control-center/shell/hostname-helper.c:199
57bc60
57bc60
https://bugzilla.gnome.org/show_bug.cgi?id=782216
57bc60
---
57bc60
 shell/hostname-helper.c | 3 +++
57bc60
 1 file changed, 3 insertions(+)
57bc60
57bc60
diff --git a/shell/hostname-helper.c b/shell/hostname-helper.c
57bc60
index 45baf5184..ab889b96b 100644
57bc60
--- a/shell/hostname-helper.c
57bc60
+++ b/shell/hostname-helper.c
57bc60
@@ -208,6 +208,9 @@ pretty_hostname_to_ssid (const char *pretty)
57bc60
 			break;
57bc60
 		}
57bc60
 
57bc60
+		if (*p == '\0')
57bc60
+			break;
57bc60
+
57bc60
 		prev = p;
57bc60
 	}
57bc60
 
57bc60
-- 
57bc60
2.12.2
57bc60