code: plan9front

Download patch

ref: fd4e8eef0b14200982c7ef08dcb978445f32c866
parent: dc8da7c232006a6894fd8742ee38c7bdfbc6d702
author: Ori Bernstein <>
date: Mon Apr 12 05:22:48 EDT 2021

Mail: correctly track the number of messages (thanks igor)

We forgot to update the message count when deleting
messages in mail, meaning we could access trailing
messages that had been freed.

--- a/sys/src/cmd/upas/Mail/mbox.c
+++ b/sys/src/cmd/upas/Mail/mbox.c
@@ -715,6 +715,7 @@
 			mbox.mesg[j++] = m;
+	mbox.nmesg = j;
 	fprint(mbox.ctl, "clean\n");