[tor-commits] [tor/master] src/common/compat.c:tor_vasprintf() - vsnprintf() was properly checked but tor_vsnprintf() available so why not use it?

nickm at torproject.org nickm at torproject.org
Tue Feb 16 16:36:01 UTC 2016


commit b3639c8291098eeeefb166914bad98a53e506b90
Author: Jeremy <jeremy at sturgix.com>
Date:   Tue Dec 1 13:00:58 2015 -0500

    src/common/compat.c:tor_vasprintf() - vsnprintf() was properly checked but tor_vsnprintf() available so why not use it?
---
 src/common/compat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/common/compat.c b/src/common/compat.c
index 6f35753..e8b0897 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -573,7 +573,9 @@ tor_vasprintf(char **strp, const char *fmt, va_list args)
   int len, r;
   va_list tmp_args;
   va_copy(tmp_args, args);
-  len = vsnprintf(buf, sizeof(buf), fmt, tmp_args);
+  /* vsnprintf() was properly checked but tor_vsnprintf() available so
+   * why not use it? */
+  len = tor_vsnprintf(buf, sizeof(buf), fmt, tmp_args);
   va_end(tmp_args);
   if (len < (int)sizeof(buf)) {
     *strp = tor_strdup(buf);





More information about the tor-commits mailing list