diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-10-23 09:21:22 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-10-23 09:21:22 -0400 |
commit | af33fdd7c1860399fe8d6861c163e5d64b0292b9 (patch) | |
tree | a66f4e8d88ccb0c808d48fc5ee4e956303559833 /src/or | |
parent | 85115796bb9095db2b59624b16c005f2252d4d71 (diff) | |
download | tor-af33fdd7c1860399fe8d6861c163e5d64b0292b9.tar.gz tor-af33fdd7c1860399fe8d6861c163e5d64b0292b9.zip |
Remove the length limit from write_http_status_line
Fixes bug 23908; bugfix on 0.3.1.6-rc when we made the keypin
failure message really long.
Backport from 0.3.2's 771fb7e7baa789c55ba15c4c26c8a4889ff9fe8d,
where arma said "get rid of the scary 256-byte-buf landmine".
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/directory.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 45fbd1dd33..bef65d3498 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -3282,14 +3282,12 @@ static void write_http_status_line(dir_connection_t *conn, int status, const char *reason_phrase) { - char buf[256]; - if (tor_snprintf(buf, sizeof(buf), "HTTP/1.0 %d %s\r\n\r\n", - status, reason_phrase ? reason_phrase : "OK") < 0) { - log_warn(LD_BUG,"status line too long."); - return; - } + char *buf = NULL; + tor_asprintf(&buf, "HTTP/1.0 %d %s\r\n\r\n", + status, reason_phrase ? reason_phrase : "OK"); log_debug(LD_DIRSERV,"Wrote status 'HTTP/1.0 %d %s'", status, reason_phrase); connection_write_to_buf(buf, strlen(buf), TO_CONN(conn)); + tor_free(buf); } /** Write the header for an HTTP/1.0 response onto <b>conn</b>-\>outbuf, |