shithub: riscv

Download patch

ref: fd4e8eef0b14200982c7ef08dcb978445f32c866
parent: dc8da7c232006a6894fd8742ee38c7bdfbc6d702
author: Ori Bernstein <[email protected]>
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 @@
 		else
 			mbox.mesg[j++] = m;
 	}
+	mbox.nmesg = j;
 		
 	close(fd);
 	fprint(mbox.ctl, "clean\n");