diff --git a/core/fifo.c b/core/fifo.c index 1a92d9bc..c59adb55 100644 --- a/core/fifo.c +++ b/core/fifo.c @@ -114,6 +114,11 @@ int uwsgi_master_fifo_manage(int fd) { return 0; } + if ((int)cmd < 0) { + uwsgi_error("invalid cmd read in uwsgi_master_fifo_manage"); + exit(1); + } + if (uwsgi_fifo_table[(int) cmd]) { uwsgi_fifo_table[(int) cmd](0); } diff --git a/core/utils.c b/core/utils.c index 48071ba8..fdf431f4 100644 --- a/core/utils.c +++ b/core/utils.c @@ -1222,7 +1222,7 @@ void uwsgi_linux_ksm_map(void) { } // we now have areas - if (uwsgi.ksm_mappings_last_size == 0 || uwsgi.ksm_mappings_current_size == 0 || uwsgi.ksm_mappings_current_size != uwsgi.ksm_mappings_last_size) { + if (uwsgi.ksm_mappings_last_size == 0 || uwsgi.ksm_mappings_current_size != uwsgi.ksm_mappings_last_size) { dirty = 1; } else { diff --git a/plugins/gevent/gevent.c b/plugins/gevent/gevent.c index 1fbe14ff..fd44bbda 100644 --- a/plugins/gevent/gevent.c +++ b/plugins/gevent/gevent.c @@ -291,7 +291,8 @@ request: } end: - Py_DECREF(greenlet_switch); + if (greenlet_switch) + Py_DECREF(greenlet_switch); end2: Py_DECREF(current_greenlet); diff --git a/plugins/router_hash/router_hash.c b/plugins/router_hash/router_hash.c index 7e980f8e..812a4992 100644 --- a/plugins/router_hash/router_hash.c +++ b/plugins/router_hash/router_hash.c @@ -81,7 +81,7 @@ static int uwsgi_routing_func_hash(struct wsgi_request *wsgi_req, struct uwsgi_r vallen = urhc->items_len; } // last item - else { + else if (value != NULL) { vallen = (urhc->items + urhc->items_len) - value; } }