diff --git a/core/utils.c b/core/utils.c index 644f52b0..2388a7ce 100644 --- a/core/utils.c +++ b/core/utils.c @@ -3652,7 +3652,7 @@ char *uwsgi_base64_decode(char *buf, size_t len, size_t *d_len) { // compute the new size *d_len = (((len+3)/4) * 3); - char *dst = uwsgi_malloc(*d_len); + char *dst = uwsgi_malloc(*d_len + 1); char *ptr = dst; uint8_t *src = (uint8_t *) buf; @@ -3674,6 +3674,7 @@ char *uwsgi_base64_decode(char *buf, size_t len, size_t *d_len) { } *d_len = (ptr - dst); + *ptr++= 0; return dst; diff --git a/plugins/router_basicauth/router_basicauth.c b/plugins/router_basicauth/router_basicauth.c index f476805b..2a9b27fc 100644 --- a/plugins/router_basicauth/router_basicauth.c +++ b/plugins/router_basicauth/router_basicauth.c @@ -80,7 +80,7 @@ int uwsgi_routing_func_basicauth(struct wsgi_request *wsgi_req, struct uwsgi_rou } } else { - if (!strcmp(auth, ur->data2)) { + if (!uwsgi_strncmp(auth, auth_len, ur->data2, ur->data2_len)) { wsgi_req->remote_user = uwsgi_req_append(wsgi_req, "REMOTE_USER", 11, auth, ur->custom); if (wsgi_req->remote_user) wsgi_req->remote_user_len = ur->custom;