[evolution-data-server] addressbook: Fix ordering of parameters to fread()



commit 9ccd4ce2042c877694dd5918c799e98d3020d252
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Nov 1 13:50:22 2014 +0000

    addressbook: Fix ordering of parameters to fread()
    
    This is a follow up to commit 2a5d6db6, since it did not eliminate the
    use of tainted data in the sense that fread() was being called with a
    variable-sized size argument, when it should be called with a
    variable-sized nmemb argument.
    
    Coverity issue: #1061517
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730381

 addressbook/libedata-book/e-book-backend-summary.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-summary.c 
b/addressbook/libedata-book/e-book-backend-summary.c
index 33fc73c..762cc29 100644
--- a/addressbook/libedata-book/e-book-backend-summary.c
+++ b/addressbook/libedata-book/e-book-backend-summary.c
@@ -274,7 +274,7 @@ read_string (FILE *fp,
              gsize len)
 {
        gchar *buf;
-       gint rv;
+       size_t rv;
 
        /* Avoid overflow for the nul byte. */
        if (len == G_MAXSIZE)
@@ -282,8 +282,8 @@ read_string (FILE *fp,
 
        buf = g_new0 (char, len + 1);
 
-       rv = fread (buf, len, 1, fp);
-       if (rv != 1) {
+       rv = fread (buf, sizeof (gchar), len, fp);
+       if (rv != len) {
                g_free (buf);
                return NULL;
        }


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