Update ProgramRedirect to check location validity

This commit is contained in:
Paul Kulchenko 2021-08-17 19:36:07 -07:00
parent b2a6752cfe
commit f12a063a40

View file

@ -750,6 +750,12 @@ static void ProgramRedirect(int code, const char *sp, size_t sn, const char *dp,
fprintf(stderr, "error: unsupported redirect code %d\n", code);
exit(1);
}
if (!(FreeLater(EncodeHttpHeaderValue(dp, dn, 0)))) {
fprintf(stderr, "error: invalid location %s\n", dp);
exit(1);
}
r.code = code;
r.path.s = sp;
r.path.n = sn;