[tor-commits] [tor/master] Never use sprintf. tor_snprintf instead. Bug in tests, not in any released tor.

nickm at torproject.org nickm at torproject.org
Tue Mar 22 13:13:08 UTC 2016


commit 9dff41694a9706f91ac175ebb7a3e23566dad189
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Mar 22 08:52:17 2016 -0400

    Never use sprintf. tor_snprintf instead. Bug in tests, not in any released tor.
---
 src/test/test_dir_handle_get.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index d74aeb6..05657ca 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -255,7 +255,7 @@ test_dir_handle_get_bytes_txt(void *data)
   tt_assert(strstr(header, "Content-Encoding: identity\r\n"));
   tt_assert(strstr(header, "Pragma: no-cache\r\n"));
 
-  sprintf(buff, "Content-Length: %ld\r\n", (long) body_len);
+  tor_snprintf(buff, sizeof(buff), "Content-Length: %ld\r\n", (long) body_len);
   tt_assert(strstr(header, buff));
 
   tt_int_op(body_used, OP_EQ, strlen(body));





More information about the tor-commits mailing list