[evolution-data-server] Bug 741275 - [IMAPx] Handle parse errors in the disposition parsing code



commit 45aa145d9f9274c23f947aa2e3dcf300efed808f
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jan 5 15:59:05 2015 +0100

    Bug 741275 - [IMAPx] Handle parse errors in the disposition parsing code
    
    The code didn’t check the return value or GError return from
    camel_imapx_input_stream_astring(), which it should. Handle errors from
    that.
    
    Coverity issue: #1257051

 camel/providers/imapx/camel-imapx-utils.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 0125f55..07e7901 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -842,12 +842,25 @@ imapx_parse_ext_optional (CamelIMAPXInputStream *stream,
                        dinfo = g_malloc0 (sizeof (*dinfo));
                        dinfo->refcount = 1;
                        /* should be string */
-                       camel_imapx_input_stream_astring (
+                       tok = camel_imapx_input_stream_astring (
                                stream, &token, cancellable, NULL);
 
+                       if (tok != IMAPX_TOK_STRING) {
+                               g_set_error (
+                                       &local_error,
+                                       CAMEL_IMAPX_ERROR, 1,
+                                       "expecting string");
+                               goto done;
+                       }
+
                        dinfo->disposition = g_strdup ((gchar *) token);
                        imapx_parse_param_list (
-                               stream, &dinfo->params, cancellable, NULL);
+                               stream, &dinfo->params, cancellable,
+                               &local_error);
+
+                       if (local_error != NULL)
+                               goto done;
+
                        break;
                case IMAPX_TOK_TOKEN:
                        break;
@@ -900,6 +913,7 @@ imapx_parse_ext_optional (CamelIMAPXInputStream *stream,
 
        }
 
+ done:
        if (local_error != NULL) {
                g_propagate_error (error, local_error);
                if (dinfo)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]