Commit b65f79d9 authored by Jay Satiro's avatar Jay Satiro
Browse files

http2: Fix address sanitizer memcpy warning

- In Curl_http2_switched don't call memcpy when src is NULL.

Curl_http2_switched can be called like:

Curl_http2_switched(conn, NULL, 0);

.. and prior to this change memcpy was then called like:

memcpy(dest, NULL, 0)

.. causing address sanitizer to warn:

http2.c:2057:3: runtime error: null pointer passed as argument 2, which
is declared to never be null
parent 03d707fc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2054,6 +2054,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
                    " after upgrade: len=%zu\n",
        nread);

  if(nread)
    memcpy(httpc->inbuf, mem, nread);
  httpc->inbuflen = nread;