# HG changeset patch # User Mark Doliner # Date 1185087193 0 # Node ID 321658bf0e03cd2100e206de17a0c0b4c3addf7f # Parent 4efd240ffaa04d85d52a7075a18f3d5c1c9910dc 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 diff -r 4efd240ffaa0 -r 321658bf0e03 libpurple/util.c --- 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;