enum state state = FLD2;
FILE *file = fopen(path, "r");
- while (state == FLD2 && !msgid && !referens) {
+ while (state == FLD2 && !(msgid && referens)) {
switch (state = m_getfld2(state, &f, file)) {
case FLD2:
if (strncasecmp("message-id", f.name, f.namelen)==0) {
msgid = f.value;
f.value = NULL;
+ f.alloclen = 0;
} else if (strncasecmp("references", f.name, f.namelen)==0) {
referens = f.value;
f.value = NULL;
+ f.alloclen = 0;
}
break;
default:
char *cp;
threadfrom = referens ? referens : msgid;
+ if (!threadfrom) {
+ return NULL;
+ }
start = strchr(threadfrom, '<');
+ if (!start) {
+ return NULL;
+ }
end = strchr(start, '>');
- if (!(*start) || !(*end)) {
+ if (!end) {
return NULL;
}
*end = '\0';