=?utf-8?q?=5Bfolks=5D_Bug_666540_=E2=80=94_Segfault_on_empty_e-mail_addre?= =?utf-8?q?sses_with_potential_match?=
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Bug 666540 â Segfault on empty e-mail addresses with potential match
- Date: Sun, 25 Dec 2011 11:00:31 +0000 (UTC)
commit 6d9b0f55ff057776c13a2a6927a853ba6e9a320d
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Dec 21 20:09:47 2011 +0000
Bug 666540 â Segfault on empty e-mail addresses with potential match
Gracefully handle invalid e-mail addresses (such as empty strings or strings
not containing an â â) when searching for potential matches.
Closes: bgo#666540
NEWS | 1 +
folks/potential-match.vala | 24 +++++++++++++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index eee9353..1cfc30a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Overview of changes from libfolks 0.6.6 to libfolks 0.6.7
Bugs fixed:
* Bug 666310 â Crash in Tracker backend by unsetting an entry in a read-only map
* Bug 666528 â Can't convert from type 'GFile' to 'gchararray'
+* Bug 666540 â Segfault on empty e-mail addresses with potential match
Overview of changes from libfolks 0.6.5 to libfolks 0.6.6
=============================================================
diff --git a/folks/potential-match.vala b/folks/potential-match.vala
index 82e2e13..eb4906c 100644
--- a/folks/potential-match.vala
+++ b/folks/potential-match.vala
@@ -254,11 +254,31 @@ public class Folks.PotentialMatch : Object
foreach (var fd_a in set_a)
{
+ string[] email_split_a = fd_a.value.split ("@");
+
+ /* Sanity check for valid e-mail addresses. */
+ if (email_split_a.length < 2)
+ {
+ warning ("Invalid e-mail address when looking for potential " +
+ "match: %s", fd_a.value);
+ continue;
+ }
+
+ string[] tokens_a =
+ email_split_a[0].split_set (this._SEPARATORS);
+
foreach (var fd_b in set_b)
{
- string[] email_split_a = fd_a.value.split ("@");
string[] email_split_b = fd_b.value.split ("@");
+ /* Sanity check for valid e-mail addresses. */
+ if (email_split_b.length < 2)
+ {
+ warning ("Invalid e-mail address when looking for " +
+ "potential match: %s", fd_b.value);
+ continue;
+ }
+
if (fd_a.value == fd_b.value)
{
if (PotentialMatch.known_email_aliases.contains
@@ -277,8 +297,6 @@ public class Folks.PotentialMatch : Object
}
else
{
- string[] tokens_a =
- email_split_a[0].split_set (this._SEPARATORS);
string[] tokens_b =
email_split_b[0].split_set (this._SEPARATORS);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]