ref: cf4a56e5170700ce5ff5fc574968b6ff90d9fa3b
parent: 664654d341b4c24e67042242bdddd3edd74679e4
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Jul 3 07:29:45 EDT 2020
imap4d: respect errors from read(), remove debug prints When read() failed, we were casting the -1 return to unsigned, which would cause us to index out of bounds. found using dovecot imap test suite. While we're here, let's remove the stray debug prints.
--- a/sys/src/cmd/upas/imap4d/fetch.c
+++ b/sys/src/cmd/upas/imap4d/fetch.c
@@ -183,8 +183,8 @@
fetchbody(Msg *m, Fetch *f)
{char *s, *t, *e, buf[Bufsize + 2];
- uint n, start, stop, pos;
- int fd, nn;
+ uint start, stop, pos;
+ int fd, n, nn;
Pair p;
if(m == nil){@@ -262,8 +262,7 @@
n = read(fd, &buf[1], n);
//ilog("read %ld at %d stop %ld\n", n, pos, stop); if(n <= 0){-ilog("must fill %ld bytes\n", stop - pos);-fprint(2, "must fill %d bytes\n", stop - pos);
+//ilog("must fill %ld bytes\n", stop - pos);fetchbodyfill(stop - pos);
break;
}
--
⑨