diff --git a/src/proto_http.c b/src/proto_http.c index 8b5caad85..b7654a67a 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1585,11 +1585,12 @@ get_http_auth(struct stream *s) h = ctx.line + ctx.val; p = memchr(h, ' ', ctx.vlen); - if (!p || p == h) + len = p - h; + if (!p || len <= 0) return 0; - chunk_initlen(&auth_method, h, 0, p-h); - chunk_initlen(&txn->auth.method_data, p+1, 0, ctx.vlen-(p-h)-1); + chunk_initlen(&auth_method, h, 0, len); + chunk_initlen(&txn->auth.method_data, p + 1, 0, ctx.vlen - len - 1); if (!strncasecmp("Basic", auth_method.str, auth_method.len)) {