[balsa] Fix endless loop
- From: Peter Bloomfield <PeterB src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [balsa] Fix endless loop
- Date: Sat, 6 Feb 2010 01:29:58 +0000 (UTC)
commit db5fb04eea896113808fcae97899825d56093032
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri Feb 5 20:26:30 2010 -0500
Fix endless loop
* libbalsa/mime.c (libbalsa_match_regex): do not loop
indefinitely when regex matches zero characters.
ChangeLog | 5 +++++
libbalsa/mime.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3335e55..9d869cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-05 Peter Bloomfield
+
+ * libbalsa/mime.c (libbalsa_match_regex): do not loop
+ indefinitely when regex matches zero characters.
+
2010-02-05 Pawel Salek
* libbalsa/imap/imap_compress.c: reduce the compressed stream
diff --git a/libbalsa/mime.c b/libbalsa/mime.c
index ec5eb94..0bd052e 100644
--- a/libbalsa/mime.c
+++ b/libbalsa/mime.c
@@ -1325,7 +1325,8 @@ libbalsa_match_regex(const gchar * line, regex_t * rex, guint * count,
const gchar *p;
c = 0;
- for (p = line; regexec(rex, p, 1, &rm, 0) == 0; p += rm.rm_eo)
+ for (p = line; !regexec(rex, p, 1, &rm, 0) && rm.rm_eo > 0;
+ p += rm.rm_eo)
c++;
if (count)
*count = c;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]