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

Re: [tor-bugs] #23908 [Core Tor/Tor]: write_http_status_line(): Bug: status line too long. (on Tor 0.3.1.7 )



#23908: write_http_status_line(): Bug: status line too long. (on Tor 0.3.1.7 )
--------------------------+------------------------------------
 Reporter:  micah         |          Owner:  (none)
     Type:  defect        |         Status:  new
 Priority:  High          |      Milestone:  Tor: 0.3.1.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by arma):

 Here is a manual backport of commit 771fb7e7:
 {{{
 diff --git a/src/or/directory.c b/src/or/directory.c
 index 45fbd1d..bef65d3 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,
 }}}

 catalyst also suggests "Make the msg shorter, like make it a link or
 something" as a fine fix.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23908#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs