From 081f6dbb1bbf4add00bfb67b3e05bba4a432d56e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 10 Dec 2001 19:14:32 +0000 Subject: Protect against either of the types being NULL. 2001-12-04 Jeffrey Stedfast * camel-mime-utils.c (header_content_type_simple): Protect against either of the types being NULL. 2001-12-05 Jeffrey Stedfast * camel-mime-filter-basic.c (filter): If complete() allocates len+2 bytes for the out buffer, so should this. See bug #16371 for an example case. 2001-12-05 Jeffrey Stedfast * camel-sasl-digest-md5.c: iconv() returns a size_t, not an int. * camel-pgp-context.c: The return value of iconv() is a size_t, not an int. * camel-mime-part-utils.c (convert_buffer): Always use size_t args for iconv(). * camel-mime-filter-charset.c (complete): Always use size_t args for iconv(). (filter): Same. * camel-mime-utils.c (header_address_fold): Make headerlen a size_t instead of an int. (header_fold): Same. (base64_encode_close): We should be returning a size_t and inlen should also be a size_t. (base64_encode_step): Same here. (base64_decode_step): Here too. (base64_encode_simple): And here... (base64_decode_simple): Same. (uuencode_close): We should also use size_t's here... (uuencode_step): And here too. (uudecode_step): And also here. (quoted_encode_close): Same idea here. (quoted_encode_step): Again here. (quoted_decode_step): Here too. (quoted_encode): Input length should be a size_t. (rfc2047_decode_word): Same. (g_string_append_len): Here too. (append_8bit): " (rfc2047_encode_word): " (quote_word): " (hex_decode): " (rfc2184_decode): Use size_t's with iconv(). (header_decode_param): Same. svn path=/trunk/; revision=14956 --- camel/camel-mime-filter-charset.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'camel/camel-mime-filter-charset.c') diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c index 537b93c5ff..d3a02ffd15 100644 --- a/camel/camel-mime-filter-charset.c +++ b/camel/camel-mime-filter-charset.c @@ -74,7 +74,7 @@ reset(CamelMimeFilter *mf) CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf; char buf[16]; char *buffer; - int outlen = 16; + size_t outlen = 16; /* what happens with the output bytes if this resets the state? */ if (f->ic != (iconv_t) -1) { @@ -87,11 +87,10 @@ static void complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace) { CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf; - int converted; + size_t converted, inlen, outlen; const char *inbuf; char *outbuf; - int inlen, outlen; - + if (f->ic == (iconv_t) -1) { goto donothing; } @@ -110,7 +109,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, if (inlen>0) { converted = e_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen); - if (converted == -1) { + if (converted == (size_t) -1) { if (errno != EINVAL) { g_warning("error occured converting: %s", strerror(errno)); goto donothing; @@ -125,7 +124,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, /* this 'resets' the output stream, returning back to the initial shift state for multishift charactersets */ converted = e_iconv(f->ic, NULL, 0, &outbuf, &outlen); - if (converted == -1) { + if (converted == (size_t) -1) { g_warning("Conversion failed to complete: %s", strerror(errno)); } @@ -153,10 +152,9 @@ static void filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace) { CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf; - int converted; + size_t converted, inlen, outlen; const char *inbuf; char *outbuf; - int inlen, outlen; if (f->ic == (iconv_t) -1) { goto donothing; @@ -169,7 +167,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s outbuf = mf->outbuf; outlen = mf->outsize; converted = e_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen); - if (converted == -1) { + if (converted == (size_t) -1) { if (errno != EINVAL) { g_warning("error occured converting: %s", strerror(errno)); goto donothing; -- cgit v1.2.3