[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 109/178: Curl_memchr: zero length input can't match
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 109/178: Curl_memchr: zero length input can't match |
Date: |
Wed, 23 May 2018 12:25:44 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit a7df35ce2130a99f26c4c8315ce46bf10804280e
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Apr 24 08:03:23 2018 +0200
Curl_memchr: zero length input can't match
Avoids undefined behavior.
Reported-by: Geeknik Labs
---
lib/curl_memrchr.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/curl_memrchr.c b/lib/curl_memrchr.c
index c521497b2..eeb3044a9 100644
--- a/lib/curl_memrchr.c
+++ b/lib/curl_memrchr.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -44,17 +44,18 @@
void *
Curl_memrchr(const void *s, int c, size_t n)
{
- const unsigned char *p = s;
- const unsigned char *q = s;
+ if(n > 0) {
+ const unsigned char *p = s;
+ const unsigned char *q = s;
- p += n - 1;
+ p += n - 1;
- while(p >= q) {
- if(*p == (unsigned char)c)
- return (void *)p;
- p--;
+ while(p >= q) {
+ if(*p == (unsigned char)c)
+ return (void *)p;
+ p--;
+ }
}
-
return NULL;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 79/178: ssh: show libSSH2 error code when closing fails, (continued)
- [GNUnet-SVN] [gnurl] 79/178: ssh: show libSSH2 error code when closing fails, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 92/178: detect_proxy: only show proxy use if it had contents, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 82/178: configure: keep LD_LIBRARY_PATH changes local, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 96/178: http2: avoid strstr() on data not zero terminated, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 93/178: ftplistparser: keep state between invokes, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 112/178: examples/http2-upload: expand buffer to avoid silly warning, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 104/178: http2: convert an assert to run-time check, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 97/178: http2: clear the "drain counter" when a stream is closed, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 102/178: CURLOPT_SSLCERT.3: improve WinSSL-specific usage info, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 89/178: schannel: fix warning, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 109/178: Curl_memchr: zero length input can't match,
gnunet <=
- [GNUnet-SVN] [gnurl] 101/178: schannel: fix build error on targets <= XP, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 121/178: cyassl: adapt to libraries without TLS 1.0 support built-in, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 123/178: http2: fix null pointer dereference in http2_connisdead, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 110/178: Revert "ftplistparser: keep state between invokes", gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 126/178: CURLINFO_PROTOCOL.3: mention the existing defined names, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 113/178: ftplistparser: keep state between invokes, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 124/178: checksrc: force indentation of lines after an else, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 107/178: ftplistparser: renamed some members and variables, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 108/178: ftplistparser: keep state between invokes, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 132/178: KNOWN_BUGS: --upload-file . hang if delay in STDIN, gnunet, 2018/05/23