Merge pull request #2639 from elyosh/pcapfixcrash
pcap: do bounds checking in net_pcap_prepare
This commit is contained in:
@@ -58,6 +58,7 @@
|
|||||||
#define NET_MAX_FRAME 1518
|
#define NET_MAX_FRAME 1518
|
||||||
#define NET_QUEUE_LEN 8
|
#define NET_QUEUE_LEN 8
|
||||||
#define NET_CARD_MAX 4
|
#define NET_CARD_MAX 4
|
||||||
|
#define NET_HOST_INTF_MAX 64
|
||||||
|
|
||||||
/* Supported network cards. */
|
/* Supported network cards. */
|
||||||
enum {
|
enum {
|
||||||
@@ -141,7 +142,7 @@ extern "C" {
|
|||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
extern int nic_do_log; /* config */
|
extern int nic_do_log; /* config */
|
||||||
extern int network_ndev;
|
extern int network_ndev;
|
||||||
extern netdev_t network_devs[32];
|
extern netdev_t network_devs[NET_HOST_INTF_MAX];
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes. */
|
/* Function prototypes. */
|
||||||
|
@@ -354,6 +354,9 @@ net_pcap_prepare(netdev_t *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (dev=devlist; dev!=NULL; dev=dev->next) {
|
for (dev=devlist; dev!=NULL; dev=dev->next) {
|
||||||
|
if (i >= (NET_HOST_INTF_MAX - 1))
|
||||||
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* we initialize the strings to NULL first for strncpy
|
* we initialize the strings to NULL first for strncpy
|
||||||
*/
|
*/
|
||||||
|
@@ -122,7 +122,7 @@ int net_card_current = 0;
|
|||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
int network_ndev;
|
int network_ndev;
|
||||||
netdev_t network_devs[32];
|
netdev_t network_devs[NET_HOST_INTF_MAX];
|
||||||
|
|
||||||
|
|
||||||
/* Local variables. */
|
/* Local variables. */
|
||||||
|
Reference in New Issue
Block a user