blaze822: blaze822_hdr_: off-by-one for first header

This commit is contained in:
Christian Neukirchen 2016-07-29 18:26:39 +02:00
parent 65b277df16
commit 4296c369f6

View File

@ -418,10 +418,12 @@ blaze822_hdr_(struct message *mesg, const char *hdr, size_t hdrlen)
return 0; // header too small for the key, probably empty return 0; // header too small for the key, probably empty
// special case: first header, no leading nul // special case: first header, no leading nul
if (memcmp(mesg->msg, hdr+1, hdrlen-1) == 0) if (memcmp(mesg->msg, hdr+1, hdrlen-1) == 0) {
v = mesg->msg; v = mesg->msg;
else hdrlen--;
} else {
v = mymemmem(mesg->msg, mesg->end - mesg->msg, hdr, hdrlen); v = mymemmem(mesg->msg, mesg->end - mesg->msg, hdr, hdrlen);
}
if (!v) if (!v)
return 0; return 0;
v += hdrlen; v += hdrlen;