[evolution-data-server] Bug 763139 - libedata-book: Validate strings from the backend summary file as UTF-8



commit f44103b1014810b985db68760c5c9a8c0568beb2
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Mar 7 16:34:56 2016 +0100

    Bug 763139 - libedata-book: Validate strings from the backend summary file as UTF-8
    
    This is another step towards catching corrupted input, validating the file as it is loaded.
    
    Coverity CID: #1061517

 addressbook/libedata-book/e-book-backend-summary.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-summary.c 
b/addressbook/libedata-book/e-book-backend-summary.c
index 8e7db25..063f7ad 100644
--- a/addressbook/libedata-book/e-book-backend-summary.c
+++ b/addressbook/libedata-book/e-book-backend-summary.c
@@ -288,6 +288,12 @@ read_string (FILE *fp,
                return NULL;
        }
 
+       /* Validate the string as UTF-8. */
+       if (!g_utf8_validate (buf, rv, NULL)) {
+               g_free (buf);
+               return NULL;
+       }
+
        return buf;
 }
 


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