[gmime] Fixed GMimeFilterBasic for uudecode
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fixed GMimeFilterBasic for uudecode
- Date: Wed, 28 Nov 2018 18:32:40 +0000 (UTC)
commit 21f265b6b3558ce34afaee6bea21b85e4b16d0cd
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Sun Nov 25 18:28:03 2018 -0500
Fixed GMimeFilterBasic for uudecode
Don't allow the outbuf to ever get set to NULL which could happen
if the begin-line had not yet been found (and thus
g_mime_filter_set_size() had never been called to allocate the
outbuf buffer).
gmime/gmime-filter-basic.c | 8 +++++---
tests/test-encoders.c | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gmime/gmime-filter-basic.c b/gmime/gmime-filter-basic.c
index f179fb68..9ba7777f 100644
--- a/gmime/gmime-filter-basic.c
+++ b/gmime/gmime-filter-basic.c
@@ -138,7 +138,7 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
while (inptr < inend) {
left = inend - inptr;
- if (left < 6) {
+ if (left <= 6) {
if (!strncmp (inptr, "begin ", left))
g_mime_filter_backup (filter, inptr, left);
break;
@@ -174,7 +174,10 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
break;
default:
/* either we haven't seen the begin-line or we've finished decoding */
- goto done;
+ *outprespace = filter->outpre;
+ *outlen = nwritten;
+ *outbuf = inbuf;
+ return;
}
}
@@ -183,7 +186,6 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
nwritten = g_mime_encoding_step (encoder, inbuf, inlen, filter->outbuf);
g_assert (nwritten <= len);
- done:
*outprespace = filter->outpre;
*outbuf = filter->outbuf;
*outlen = nwritten;
diff --git a/tests/test-encoders.c b/tests/test-encoders.c
index 989d26f3..1aa2c0b5 100644
--- a/tests/test-encoders.c
+++ b/tests/test-encoders.c
@@ -358,8 +358,8 @@ int main (int argc, char **argv)
test_encoder (GMIME_CONTENT_ENCODING_UUENCODE, photo, uu, 1);
test_decoder (GMIME_CONTENT_ENCODING_UUENCODE, uu, photo, 4096);
test_decoder (GMIME_CONTENT_ENCODING_UUENCODE, uu, photo, 1024);
- //test_decoder (GMIME_CONTENT_ENCODING_UUENCODE, uu, photo, 16);
- //test_decoder (GMIME_CONTENT_ENCODING_UUENCODE, uu, photo, 1);
+ test_decoder (GMIME_CONTENT_ENCODING_UUENCODE, uu, photo, 16);
+ test_decoder (GMIME_CONTENT_ENCODING_UUENCODE, uu, photo, 1);
testsuite_end ();
g_mime_shutdown ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]