aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorJeremy <jeremy@sturgix.com>2015-12-01 12:27:29 -0500
committerJeremy <jeremy@sturgix.com>2015-12-01 12:27:29 -0500
commitfcc6541fdee2af8005766c3cd4b81e5edd8ae5ea (patch)
tree076e4caafa79096dce6de254ab98edf2e1ba8382 /src/common/compat.c
parent232ccc18c40f0d0302b2e21b0f67885c548f8e63 (diff)
downloadtor-fcc6541fdee2af8005766c3cd4b81e5edd8ae5ea.tar.gz
tor-fcc6541fdee2af8005766c3cd4b81e5edd8ae5ea.zip
src/common/compat.c:tor_vasprintf() - changed vsnprintf() to tor_vsnprintf() which ensures string is null terminated.
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 7d72b4b7fd..6f357530a6 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;