shithub: plan9front

Download patch

ref: fd4e8eef0b14200982c7ef08dcb978445f32c866
parent: dc8da7c232006a6894fd8742ee38c7bdfbc6d702
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Apr 12 12: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	Mon Apr 12 04:29:54 2021
+++ b/sys/src/cmd/upas/Mail/mbox.c	Mon Apr 12 12:22:48 2021
@@ -715,6 +715,7 @@
 		else
 			mbox.mesg[j++] = m;
 	}
+	mbox.nmesg = j;
 		
 	close(fd);
 	fprint(mbox.ctl, "clean\n");