cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
568 stars 104 forks source link

Rule arg may segfault upon empty value #1212

Closed skinkie closed 6 years ago

skinkie commented 6 years ago
0x00007ffff7e54d1e in check_argument (rule=0x4a0e80, value=0x0) at rule_url_arg.c:49
49                              value->len,
(gdb) bt
#0  0x00007ffff7e54d1e in check_argument (rule=0x4a0e80, value=0x0) at rule_url_arg.c:49
#1  0x00007ffff7e54f0d in match (rule=0x4a0e80, conn=0x7fff580051b0, ret_conf=0x7fff580051e0) at rule_url_arg.c:122
#2  0x00007ffff7f79917 in cherokee_rule_match (rule=0x4a0e80, cnt=0x7fff580051b0, ret_conf=0x7fff580051e0) at rule.c:116
#3  0x00007ffff7e57af8 in match (rule=0x4a06b0, conn=0x7fff580051b0, ret_conf=0x7fff580051e0) at rule_and.c:50
#4  0x00007ffff7f79917 in cherokee_rule_match (rule=0x4a06b0, cnt=0x7fff580051b0, ret_conf=0x7fff580051e0) at rule.c:116
#5  0x00007ffff7f79ba4 in cherokee_rule_list_match (list=0x495a80, conn=0x7fff580051b0, ret_config=0x7fff580051e0) at rule_list.c:101
#6  0x00007ffff7f85823 in process_active_connections (thd=0x7b3510) at thread.c:1027
#7  0x00007ffff7f8782e in cherokee_thread_step_MULTI_THREAD (thd=0x7b3510, dont_block=false) at thread.c:2067
#8  0x00007ffff7f83bfc in thread_routine (data=0x7b3510) at thread.c:99
#9  0x00007ffff7bc7314 in start_thread () from /lib64/libpthread.so.0
#10 0x00007ffff74da51d in clone () from /lib64/libc.so.6
skinkie commented 6 years ago
static ret_t
check_argument (cherokee_rule_url_arg_t *rule,
                cherokee_buffer_t       *value)
{
        int re;
        cherokee_buffer_t empty = CHEROKEE_BUF_INIT;
        if (value == NULL) value = ∅

Could by a solution, but the problem that I am actually trying to solve is having an empty match.

skinkie commented 6 years ago

Additionally the admin accepts an empty "match" which then prevents Cherokee to start. This is only happening when and/or is used. Split into #1213