decode/ipv4: fix ts opt flags decoding

Field is at data+1 offset, not +3. Also makes sure we always stay
within checked data bounds.

Reported-by: Sirko Höer -- Code Intelligence for DCSO.

Bug #3176.
pull/4243/head
Victor Julien 6 years ago
parent 7bb3dfcfc8
commit 4ca83ca489

@ -159,7 +159,7 @@ static int IPV4OptValidateTimestamp(Packet *p, const IPV4Opt *o)
ENGINE_SET_INVALID_EVENT(p, IPV4_OPT_MALFORMED);
return -1;
}
flag = *(o->data + 3) & 0x00ff;
flag = *(o->data + 1) & 0x0f;
/* A flag of 1|3 means we have both the ip+ts in each record */
rec_size = ((flag == 1) || (flag == 3)) ? 8 : 4;

Loading…
Cancel
Save