[libsoup/gnome-3-28] soup: Fix nonnull parameter issues found by Coverity Scan and clang



commit 0ce455bece32ad7315108e8ad6ad93884c7c89c9
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 25 14:58:27 2018 +0200

    soup: Fix nonnull parameter issues found by Coverity Scan and clang
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781771

 libsoup/soup-content-sniffer-stream.c | 3 ++-
 libsoup/soup-uri.c                    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-content-sniffer-stream.c b/libsoup/soup-content-sniffer-stream.c
index b8a8c97e..7f74c705 100644
--- a/libsoup/soup-content-sniffer-stream.c
+++ b/libsoup/soup-content-sniffer-stream.c
@@ -167,7 +167,8 @@ read_internal (GInputStream  *stream,
 
        if (sniffer->priv->buffer) {
                nread = MIN (count, sniffer->priv->buffer_nread);
-               memcpy (buffer, sniffer->priv->buffer, nread);
+               if (buffer)
+                       memcpy (buffer, sniffer->priv->buffer, nread);
                if (nread == sniffer->priv->buffer_nread) {
                        g_free (sniffer->priv->buffer);
                        sniffer->priv->buffer = NULL;
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index be778d6c..74c362e9 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -1348,7 +1348,7 @@ soup_uri_is_http (SoupURI *uri, char **aliases)
                        return TRUE;
        }
 
-       if (!aliases[1] && !strcmp (aliases[0], "*"))
+       if (aliases[0] && !aliases[1] && !strcmp (aliases[0], "*"))
                return TRUE;
        else
                return FALSE;


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