nat: Compare the DTAP L3 size with the size of the msgb - dtap header

This commit is contained in:
Holger Hans Peter Freyther
2012-01-10 22:27:43 +01:00
parent 8c36fdb1d8
commit c2c0ea700b

View File

@@ -635,8 +635,10 @@ struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed,
return NULL;
}
if (*len < sizeof(struct gsm48_hdr)) {
LOGP(DNAT, LOGL_ERROR, "GSM48 header does not fit.\n");
if (msgb_l3len(msg) - 3 < msg->l3h[2]) {
LOGP(DNAT, LOGL_ERROR,
"GSM48 payload does not fit: %d %d\n",
msg->l3h[2], msgb_l3len(msg) - 3);
return NULL;
}