summaryrefslogtreecommitdiff
path: root/sys/src/cmd/upas/imap4d
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-07-03 11:29:45 -0700
committerOri Bernstein <ori@eigenstate.org>2020-07-03 11:29:45 -0700
commita71450412a9e1fc47d3b7d7dbac604b8a93f68e2 (patch)
tree811c37b23bd96b433bbfeee6ce232c18b0bf5162 /sys/src/cmd/upas/imap4d
parenta3a4f5c3e3be563642aa10302b7aa0d1dba4ad17 (diff)
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.
Diffstat (limited to 'sys/src/cmd/upas/imap4d')
-rw-r--r--sys/src/cmd/upas/imap4d/fetch.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/src/cmd/upas/imap4d/fetch.c b/sys/src/cmd/upas/imap4d/fetch.c
index d3e6ef3cc..78a76f912 100644
--- a/sys/src/cmd/upas/imap4d/fetch.c
+++ b/sys/src/cmd/upas/imap4d/fetch.c
@@ -183,8 +183,8 @@ void
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 @@ fetchbody(Msg *m, Fetch *f)
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;
}