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

This commit is contained in:
Jeremy 2015-12-01 13:00:58 -05:00
parent 86a5305d46
commit b3639c8291

View File

@ -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);