pcu_sock: Discard messages that are too short
The downstream code of pcu_sock.c doesn't contain any length checks, so let's discard any messages that are shorter than the primitive length. Change-Id: I35ac84d4db6d21ea61afbd1864c810bbf601d69b
This commit is contained in:
parent
e1ff92b8dd
commit
70a0ee56f7
|
@ -749,6 +749,12 @@ static int pcu_sock_read(struct osmo_fd *bfd)
|
|||
goto close;
|
||||
}
|
||||
|
||||
if (rc < sizeof(*pcu_prim)) {
|
||||
LOGP(DPCU, LOGL_ERROR, "Received %d bytes on PCU Socket, but primitive size "
|
||||
"is %lu, discarding\n", rc, sizeof(*pcu_prim));
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = pcu_rx(state->net, pcu_prim->msg_type, pcu_prim);
|
||||
|
||||
/* as we always synchronously process the message in pcu_rx() and
|
||||
|
|
Loading…
Reference in New Issue