Commit 5177b995 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix an assert which was (safe) off by one.

Strengthen another assert for increased safety.

Fixes: #1749
parent ecadacb3
......@@ -201,7 +201,7 @@ void
http_SetH(const struct http *to, unsigned n, const char *fm)
{
assert(n < to->shd);
assert(n < to->nhd);
AN(fm);
to->hd[n].b = TRUST_ME(fm);
to->hd[n].e = strchr(to->hd[n].b, '\0');
......@@ -816,7 +816,7 @@ HTTP_Encode(const struct http *fm, uint8_t *p0, unsigned l, unsigned how)
p = p0;
e = p + l;
assert(p + 5 <= e);
assert(fm->nhd < fm->shd);
assert(fm->nhd <= fm->shd);
n = HTTP_HDR_FIRST - 3;
vbe16enc(p + 2, fm->status);
p += 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment