Open
Description
patch below.
getname() - avoid segfault when parsing email address
When searching for "comments" containing a person's name (eg "Fred Nurk")
after an email address (eg <[email protected]>) it is possible that the
trailing > is missing. This can be caused by spamify_replacedomain() not
being careful enough in how it substitutes the domain name. In such cases
strchr() will return a value that could cause a segfault, so take a little
care that we have something valid before attempting to find the comment
segment of the header line.
In some cases the closing '>' of an email address may be missing.
diff --git a/src/getname.c b/src/getname.c
index 740ebc5..2001cd3 100644
--- a/src/getname.c
+++ b/src/getname.c
@@ -249,12 +249,15 @@ void getname(char *line, char **namep, char **emailp)
}
else if (*c == '<') { /* Comment may be on the end */
/* From: <[email protected]> Bill Campbell */
- c = strchr(line, '>') + 1;
- for (i = 0, len = NAMESTRLEN - 1; *c && *c != '\n' && i < len; c++)
- name[i++] = *c;
-
- comment_fnd = 1;
+ if (strchr(line, '>')) {
+ c = strchr(line, '>') + 1;
+ for (i = 0, len = NAMESTRLEN - 1; *c && *c != '\n' && i < len; c++)
+ name[i++] = *c;
+
+ comment_fnd = 1;
+ }
}
+
}
else if (strchr(line, '(')) {
c = strchr(line, '(');
--
1.7.2.5
Metadata
Metadata
Assignees
Labels
No labels