gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnurl] 70/125: rand: add a clang-analyzer work-around


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 70/125: rand: add a clang-analyzer work-around
Date: Sun, 21 Jan 2018 23:42:05 +0100

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

ng0 pushed a commit to branch master
in repository gnurl.

commit 02f207a76b45129e4d033c099e6d17581801c76e
Author: Daniel Stenberg <address@hidden>
AuthorDate: Wed Dec 13 00:45:42 2017 +0100

    rand: add a clang-analyzer work-around
    
    scan-build would warn on a potential access of an uninitialized
    buffer. I deem it a false positive and had to add this somewhat ugly
    work-around to silence it.
---
 lib/rand.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/rand.c b/lib/rand.c
index 2670af9d9..0769ed151 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -157,6 +157,12 @@ CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned 
char *rnd,
   unsigned char *bufp = buffer;
   DEBUGASSERT(num > 1);
 
+#ifdef __clang_analyzer__
+  /* This silences a scan-build warning about accesssing this buffer with
+     uninitialized memory. */
+  memset(buffer, 0, sizeof(buffer));
+#endif
+
   if((num/2 >= sizeof(buffer)) || !(num&1))
     /* make sure it fits in the local buffer and that it is an odd number! */
     return CURLE_BAD_FUNCTION_ARGUMENT;

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



reply via email to

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