changeset 30585:7f021333e41f

Prevent an invalid read when a message starts with 'mailto:'.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 03 Jun 2010 23:08:11 +0000
parents f06be7aff71c
children 626480462902
files libpurple/util.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Thu Jun 03 22:59:19 2010 +0000
+++ b/libpurple/util.c	Thu Jun 03 23:08:11 2010 +0000
@@ -2163,7 +2163,7 @@
 					if (t - c == 7) {
 						break;
 					}
-					if (*(t - 1) == '.')
+					if (t > text && *(t - 1) == '.')
 						t--;
 					if ((d = strstr(c + 7, "?")) != NULL && d < t)
 						url_buf = g_strndup(c + 7, d - c - 7);
@@ -2183,10 +2183,7 @@
 					c = t;
 					break;
 				}
-				if (!t)
-					break;
 				t++;
-
 			}
 		} else if (c != text && (*c == '@')) {
 			int flag;