mirror of
https://github.com/leahneukirchen/mblaze
synced 2024-11-15 18:14:02 +00:00
blaze822: blaze822_hdr_: off-by-one for first header
This commit is contained in:
parent
65b277df16
commit
4296c369f6
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user