[evolution-data-server] CamelMimeFilterEnriched: Add safety checks into enriched_to_html()



commit 5690596ed9c2b2a442d20668249314768328513d
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 7 14:01:20 2021 +0200

    CamelMimeFilterEnriched: Add safety checks into enriched_to_html()
    
    In case the user data contains a parameter unknown to the code, it would
    use a NULL pointer, generating invalid output.
    
    This had been caught by a gcc static analyzer.

 src/camel/camel-mime-filter-enriched.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/camel-mime-filter-enriched.c b/src/camel/camel-mime-filter-enriched.c
index 37a703c24..18bbff319 100644
--- a/src/camel/camel-mime-filter-enriched.c
+++ b/src/camel/camel-mime-filter-enriched.c
@@ -416,14 +416,14 @@ enriched_to_html (CamelMimeFilter *mime_filter,
 
                                                len = inptr - start;
                                                param = param_parse (enriched_tag, start, len);
-                                               len = strlen (param);
+                                               len = param ? strlen (param) : 0;
 
                                                inptr += 7;
 
                                                len += strlen (html_tag);
 
                                                if ((outptr + len) < outend) {
-                                                       outptr += snprintf (outptr, len, html_tag, param);
+                                                       outptr += snprintf (outptr, len, html_tag, param ? 
param : "");
                                                        g_free (param);
                                                } else {
                                                        g_free (param);


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