gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnurl] 122/178: http2: get rid of another strstr()


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 122/178: http2: get rid of another strstr()
Date: Wed, 23 May 2018 12:25:57 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit 2ef1662e4bc20f1641bc678141c2df0e42e21e3f
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Apr 26 10:41:21 2018 +0200

    http2: get rid of another strstr()
    
    Follow-up to 1514c44655e12e: replace another strstr() call done on a
    buffer that might not be zero terminated - with a memchr() call, even if
    we know the substring will be found.
    
    Assisted-by: Max Dymond
    
    Detected by OSS-Fuzz
    Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8021
    
    Closes #2534
---
 lib/http2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/http2.c b/lib/http2.c
index 7dea16125..25d74c1a1 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1923,8 +1923,10 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
 
     hdbuf = line_end + 2;
 
-    line_end = strstr(hdbuf, "\r\n");
-    if(line_end == hdbuf)
+    /* check for next CR, but only within the piece of data left in the given
+       buffer */
+    line_end = memchr(hdbuf, '\r', len - (hdbuf - (char *)mem));
+    if(!line_end || (line_end == hdbuf))
       goto fail;
 
     /* header continuation lines are not supported */

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]