diff options
author | Dan Winship <danw@src.gnome.org> | 2000-11-30 04:04:16 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-11-30 04:04:16 +0800 |
commit | bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6 (patch) | |
tree | 0886ebe958fecf8708b551d83419ce903cc8caf0 | |
parent | 292dd96540823a9e7969701c95341eada2ce16f6 (diff) | |
download | gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar.gz gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar.bz2 gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar.lz gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar.xz gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar.zst gsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.zip |
Fix some off-by-one-ness.
* 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.
svn path=/trunk/; revision=6718
-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); |