Fix DHCP server heap corruption per recommendation by Espressif (#1421)

To avoid crash in DHCP big packages modify option length from 312 to MTU - IPHEAD(20) - UDPHEAD(8) - DHCPHEAD(236).
This commit is contained in:
Arnim Läuger 2016-08-02 22:30:11 +02:00 committed by Marcel Stör
parent 7f8a2b2c19
commit ff46abe61f
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,8 @@
#ifndef __DHCPS_H__ #ifndef __DHCPS_H__
#define __DHCPS_H__ #define __DHCPS_H__
#include "lwipopts.h"
#define USE_DNS #define USE_DNS
typedef struct dhcps_state{ typedef struct dhcps_state{
@ -19,7 +21,9 @@ typedef struct dhcps_msg {
uint8_t chaddr[16]; uint8_t chaddr[16];
uint8_t sname[64]; uint8_t sname[64];
uint8_t file[128]; uint8_t file[128];
uint8_t options[312]; // Recommendation from Espressif:
// To avoid crash in DHCP big packages modify option length from 312 to MTU - IPHEAD(20) - UDPHEAD(8) - DHCPHEAD(236).
uint8_t options[IP_FRAG_MAX_MTU - 20 - 8 - 236];
}dhcps_msg; }dhcps_msg;
#ifndef LWIP_OPEN_SRC #ifndef LWIP_OPEN_SRC