|
@@ -139,8 +139,15 @@ static int arp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
139
|
139
|
struct arp_net_protocol *arp_net_protocol;
|
140
|
140
|
struct net_protocol *net_protocol;
|
141
|
141
|
struct ll_protocol *ll_protocol;
|
|
142
|
+ size_t len = iob_len ( iobuf );
|
142
|
143
|
int rc;
|
143
|
144
|
|
|
145
|
+ /* Sanity check */
|
|
146
|
+ if ( ( len < sizeof ( *arphdr ) ) || ( len < arp_len ( arphdr ) ) ) {
|
|
147
|
+ rc = -EINVAL;
|
|
148
|
+ goto done;
|
|
149
|
+ }
|
|
150
|
+
|
144
|
151
|
/* Identify network-layer and link-layer protocols */
|
145
|
152
|
arp_net_protocol = arp_find_protocol ( arphdr->ar_pro );
|
146
|
153
|
if ( ! arp_net_protocol ) {
|