about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--mdeliver.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/mdeliver.c b/mdeliver.c
index ea68647..cbd049a 100644
--- a/mdeliver.c
+++ b/mdeliver.c
@@ -115,15 +115,16 @@ tryagain:
 				break;
 
 			if (Mflag && in_header &&
-			    (strncasecmp("status:", line, 6) == 0 ||
-			     strncasecmp("x-status:", line, 8) == 0)) {
+			    (strncasecmp("status:", line, 7) == 0 ||
+			     strncasecmp("x-status:", line, 9) == 0)) {
 				char *v = strchr(line, ':');
-				if (strchr(v, 'F')) statusflags[0] = 'F';
-				if (strchr(v, 'A')) statusflags[1] = 'R';
-				if (strchr(v, 'R')) statusflags[2] = 'S';
-				if (strchr(v, 'D')) statusflags[3] = 'T';
-				if (strchr(v, 'O')) is_old = 1;
-
+				if (v) {
+					if (strchr(v, 'F')) statusflags[0] = 'F';
+					if (strchr(v, 'A')) statusflags[1] = 'R';
+					if (strchr(v, 'R')) statusflags[2] = 'S';
+					if (strchr(v, 'D')) statusflags[3] = 'T';
+					if (strchr(v, 'O')) is_old = 1;
+				}
 				continue;  // drop header
 			}