aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-11-30 04:04:16 +0800
committerDan Winship <danw@src.gnome.org>2000-11-30 04:04:16 +0800
commitbb04a38e88b9a338ed9f4c7998a93e142f0c1bd6 (patch)
tree0886ebe958fecf8708b551d83419ce903cc8caf0 /camel/providers
parent292dd96540823a9e7969701c95341eada2ce16f6 (diff)
downloadgsoc2013-evolution-bb04a38e88b9a338ed9f4c7998a93e142f0c1bd6.tar.gz
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
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-command.c6
1 files changed, 3 insertions, 3 deletions
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);