changeset 18600:321658bf0e03

Valgrind was showing "Invalid read of size 1" when a string is passed to this function that doesn't have an @ in it. I think this bug exists in the O'Reilly version, too
author Mark Doliner <mark@kingant.net>
date Sun, 22 Jul 2007 06:53:13 +0000
parents 4efd240ffaa0
children ac9f19a31051
files libpurple/util.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Sun Jul 22 00:59:51 2007 +0000
+++ b/libpurple/util.c	Sun Jul 22 06:53:13 2007 +0000
@@ -3994,6 +3994,10 @@
 		if (*c <= ' ' || *c >= 127) return FALSE;
 		if (strchr(rfc822_specials, *c)) return FALSE;
 	}
+
+	/* It's obviously not an email address if we didn't find an '@' above */
+	if (*c == '\0') return FALSE;
+
 	/* strictly we should return false if (*(c - 1) == '.') too, but I think
 	 * we should permit user.@domain type addresses - they do work :) */
 	if (c == address) return FALSE;