diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index a6d69591900..4f0e7785a62 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.101 2026/03/27 08:10:46 job Exp $ */ +/* $OpenBSD: http.c,v 1.102 2026/04/09 18:35:49 claudio Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2020 Claudio Jeker @@ -1381,9 +1381,14 @@ http_parse_header(struct http_connection *conn, char *buf) cp = buf; /* empty line, end of header */ - if (*cp == '\0') + if (*cp == '\0') { + /* check consistency of header fields */ + if (http_isredirect(conn) && conn->redir_uri == NULL) { + warnx("%s: redirect with no location", conn->req->uri); + return -1; + } return 0; - else if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) { + } else if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) { cp += sizeof(CONTENTLEN) - 1; cp += strspn(cp, " \t"); conn->iosz = strtonum(cp, 0, MAX_CONTENTLEN, &errstr);