diff options
-rw-r--r-- | camel/ChangeLog | 8 | ||||
-rw-r--r-- | camel/camel-stream-buffer.c | 2 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-command.c | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index c3f7bb030a..47945a66b4 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2000-11-29 Dan Winship <danw@helixcode.com> + + * providers/imap/camel-imap-command.c (imap_read_untagged): Fix + some off-by-one-ness. + + * camel-stream-buffer.c (stream_read): Fix another bug found in + previously-unused code here. + 2000-11-29 Ettore Perazzoli <ettore@helixcode.com> * tests/lib/Makefile.am (INCLUDES): `$(top_srcdir)' for builddir diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c index 8641206006..dd5f0bc287 100644 --- a/camel/camel-stream-buffer.c +++ b/camel/camel-stream-buffer.c @@ -257,7 +257,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n) } } } else { - memcpy(bptr, sbf->ptr, bytes_left); + memcpy(bptr, sbf->ptr, n); sbf->ptr += n; bptr += n; n = 0; diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 4f2b0ca500..f490ec0e1f 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -273,7 +273,7 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex) FALSE, NULL); goto lose; } - str->str[length] = '\0'; + str->str[length + 1] = '\0'; /* Fix up the literal, turning CRLFs into LF. Also, if * we find any embedded NULs, strip them. This is @@ -292,7 +292,7 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex) s = d = str->str + 1; end = str->str + 1 + length; while (s < end) { - while (*s == '\0' && s < end) { + while (s < end && *s == '\0') { s++; length--; } @@ -313,7 +313,7 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex) * don't want it to be shorter either, because then the * GString's length would be off... */ - sprintf (p, "{%0*d}", ldigits, str->len); + sprintf (p, "{%0*d}", ldigits, length); fulllen += str->len; g_ptr_array_add (data, str); |