Skip to content

Commit

Permalink
Fix Crash when using Closest Match error handler
Browse files Browse the repository at this point in the history
Fix #1270

The raw buffer under 'cherokee_buffer' was used directly without guarding it may have been empty.
Thanks @mmmds for the elaborative report.
  • Loading branch information
skinkie committed Oct 16, 2021
1 parent 83246ce commit 77ddd63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cherokee/handler_error_nn.c
Expand Up @@ -113,6 +113,10 @@ get_nearest_name (cherokee_connection_t *conn,
cherokee_thread_t *thread = CONN_THREAD(conn);
cherokee_buffer_t *req = THREAD_TMP_BUF1(thread);

if (cherokee_buffer_is_empty (&conn->request)) {
return ret_error;
}

/* Build the local request path
*/
rest = strrchr (request->buf, '/');
Expand Down

0 comments on commit 77ddd63

Please sign in to comment.