[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] src/common/compat.c:tor_vasprintf() - changed vsnprintf() to tor_vsnprintf() which ensures string is null terminated.



commit fcc6541fdee2af8005766c3cd4b81e5edd8ae5ea
Author: Jeremy <jeremy@xxxxxxxxxxx>
Date:   Tue Dec 1 12:27:29 2015 -0500

    src/common/compat.c:tor_vasprintf() - changed vsnprintf() to tor_vsnprintf() which ensures string is null terminated.
---
 src/common/compat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/common/compat.c b/src/common/compat.c
index 7d72b4b..6f35753 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -580,7 +580,8 @@ tor_vasprintf(char **strp, const char *fmt, va_list args)
     return len;
   }
   strp_tmp = tor_malloc(len+1);
-  r = vsnprintf(strp_tmp, len+1, fmt, args);
+  /* use of tor_vsnprintf() will ensure string is null terminated */
+  r = tor_vsnprintf(strp_tmp, len+1, fmt, args);
   if (r != len) {
     tor_free(strp_tmp);
     *strp = NULL;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits