aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-01 03:57:49 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-01 03:57:49 +0800
commitf67eb8f79172e77dadb0c02636409e087856baeb (patch)
tree7f1e6639419321bd4d39e2e86b7becd27de00bac /camel/camel-mime-utils.c
parentf2f9d28a0b9c5492f3760103a8e63a21aaf47c79 (diff)
downloadgsoc2013-evolution-f67eb8f79172e77dadb0c02636409e087856baeb.tar.gz
gsoc2013-evolution-f67eb8f79172e77dadb0c02636409e087856baeb.tar.zst
gsoc2013-evolution-f67eb8f79172e77dadb0c02636409e087856baeb.zip
A few string overrun checks for the mime parser
svn path=/trunk/; revision=4427
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index e6b7e0350b..edfda90ed8 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -794,8 +794,8 @@ header_decode_lwsp(const char **in)
d2(printf("is ws: '%s'\n", *in));
- while (is_lwsp(*inptr) || *inptr =='(') {
- while (is_lwsp(*inptr)) {
+ while (is_lwsp(*inptr) || *inptr =='(' && *inptr != '\0') {
+ while (is_lwsp(*inptr) && inptr != '\0') {
d2(printf("(%c)", *inptr));
inptr++;
}
@@ -805,7 +805,7 @@ header_decode_lwsp(const char **in)
if (*inptr == '(') {
int depth = 1;
inptr++;
- while (depth && (c=*inptr)) {
+ while (depth && (c=*inptr) && *inptr != '\0') {
if (c=='\\' && inptr[1]) {
inptr++;
} else if (c=='(') {
@@ -1122,7 +1122,7 @@ header_decode_quoted_string(const char **in)
/* first, calc length */
inptr++;
intmp = inptr;
- while ( (c = *intmp++) && c!= '"' ) {
+ while ( (c = *intmp++) && c!= '"' && c != '\0') {
if (c=='\\' && *intmp) {
intmp++;
skip++;
@@ -1130,7 +1130,7 @@ header_decode_quoted_string(const char **in)
}
outlen = intmp-inptr-skip;
out = outptr = g_malloc(outlen+1);
- while ( (c = *inptr++) && c!= '"' ) {
+ while ( (c = *inptr++) && c!= '"' && c != '\0') {
if (c=='\\' && *inptr) {
c = *inptr++;
}