Skip to content

Commit

Permalink
mod_http_proxy: Fix CONNECT crash if missing hostname.
Browse files Browse the repository at this point in the history
If the request line does not include a hostname for
CONNECT proxy requests, we could copy from a NULL
source buffer, leading to a SEGV. If this happens,
the request is malformed, so just abort.
  • Loading branch information
InterLinked1 committed Nov 19, 2023
1 parent 18e401f commit dcecb7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions modules/mod_asterisk_queues.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ int bbs_queue_call_handler_unregister(const char *name)
return 0;
}

//static pthread_mutex_t queue_lock = PTHREAD_MUTEX_INITIALIZER;

static char system_title[42];
static char call_menu_title[48];
static char queue_id_var[64];
Expand Down
4 changes: 4 additions & 0 deletions modules/mod_http_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ static enum http_response_code proxy_handler(struct http_session *http)

/* Want the host without the port attached */
if (http->req->method & HTTP_METHOD_CONNECT) {
if (strlen_zero(http->req->host)) {
bbs_warning("CONNECT request missing hostname\n");
return HTTP_BAD_REQUEST;
}
bbs_strncpy_until(hostbuf, http->req->host, sizeof(hostbuf), ':'); /* Strip : */
host = hostbuf;
} else {
Expand Down

0 comments on commit dcecb7a

Please sign in to comment.