[tor-commits] [tor/maint-0.4.1] util/map_anon_nofork: Add a cast to avoid passing -48 to memset

teor at torproject.org teor at torproject.org
Wed Nov 6 01:21:46 UTC 2019


commit 9b73088c14fe24a1554950363fb80468c695937f
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Oct 3 07:21:25 2019 -0400

    util/map_anon_nofork: Add a cast to avoid passing -48 to memset
    
    This fixes coverity CID 1454593, and bug 31948. Bug not in any
    released version of Tor.
---
 src/test/test_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 6ecff6f1c..b4d8a4d76 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6190,7 +6190,7 @@ test_util_map_anon_nofork(void *arg)
   tor_munmap_anonymous(ptr, sz);
   ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, &inherit);
   tt_ptr_op(ptr, OP_NE, 0);
-  memset(ptr, TEST_VALUE, sz);
+  memset(ptr, (uint8_t)TEST_VALUE, sz);
 
   tt_int_op(0, OP_EQ, pipe(pipefd));
   pid_t child = fork();





More information about the tor-commits mailing list