Merge remote-tracking branch 'tor-github/pr/1417'

This commit is contained in:
Nick Mathewson
2019-10-22 08:36:32 -04:00
4 changed files with 9 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
o Minor features (defense in depth):
- Add additional sanity checks around tor_vasprintf() usage in case the
function returns an error. Patch by Tobias Stoeckmann. Fixes ticket 31147.
+4 -1
View File
@@ -1653,7 +1653,10 @@ control_event_status(int type, int severity, const char *format, va_list args)
log_warn(LD_BUG, "Format string too long.");
return -1;
}
tor_vasprintf(&user_buf, format, args);
if (tor_vasprintf(&user_buf, format, args)<0) {
log_warn(LD_BUG, "Failed to create user buffer.");
return -1;
}
send_control_event(type, "%s %s\r\n", format_buf, user_buf);
tor_free(user_buf);
+1
View File
@@ -578,6 +578,7 @@ buf_add_vprintf(buf_t *buf, const char *format, va_list args)
/* XXXX Faster implementations are easy enough, but let's optimize later */
char *tmp;
tor_vasprintf(&tmp, format, args);
tor_assert(tmp != NULL);
buf_add(buf, tmp, strlen(tmp));
tor_free(tmp);
}
+1
View File
@@ -550,6 +550,7 @@ process_vprintf(process_t *process,
char *data;
size = tor_vasprintf(&data, format, args);
tor_assert(data != NULL);
process_write(process, (uint8_t *)data, size);
tor_free(data);
}