mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-15 10:29:47 +00:00
strenghten len checks
This commit is contained in:
1 parent
8bb65c6492
commit
751f14742d
2 files changed
+6
-2
No files matched your search
+3
-1
@@ -5596,6 +5596,7 @@ static void ppp_handle_lcp(struct mg_tcpip_if *ifp, uint8_t *lcpp,
|
||||
if (lcpsz < sizeof(*lcp)) return;
|
||||
id = lcp->id;
|
||||
len = mg_ntohs(lcp->len);
|
||||
if (len < sizeof(*lcp) || len > lcpsz) return;
|
||||
switch (lcp->code) {
|
||||
case MG_PPP_LCP_CFG_REQ: {
|
||||
if (len == sizeof(*lcp)) {
|
||||
@@ -5652,7 +5653,7 @@ static void ppp_handle_ipcp(struct mg_tcpip_if *ifp, uint8_t *ipcpp,
|
||||
if (ipcpsz < sizeof(*ipcp)) return;
|
||||
id = ipcp->id;
|
||||
len = mg_ntohs(ipcp->len);
|
||||
if (len > ipcpsz) return;
|
||||
if (len < sizeof(*ipcp) || len > ipcpsz) return;
|
||||
switch (ipcp->code) {
|
||||
case MG_PPP_IPCP_CFG_REQ:
|
||||
MG_VERBOSE(("got IPCP config request, acknowledging..."));
|
||||
@@ -5712,6 +5713,7 @@ static void ppp_handle_ipv6cp(struct mg_tcpip_if *ifp, uint8_t *ipv6cpp,
|
||||
if (ipv6cpsz < sizeof(*ipv6cp)) return;
|
||||
id = ipv6cp->id;
|
||||
len = mg_ntohs(ipv6cp->len);
|
||||
if (len < sizeof(*ipv6cp) || len > ipv6cpsz) return;
|
||||
switch (ipv6cp->code) {
|
||||
case MG_PPP_IPV6CP_CFG_REQ:
|
||||
MG_VERBOSE(("got IPV6CP config request..."));
|
||||
|
||||
+3
-1
@@ -243,6 +243,7 @@ static void ppp_handle_lcp(struct mg_tcpip_if *ifp, uint8_t *lcpp,
|
||||
if (lcpsz < sizeof(*lcp)) return;
|
||||
id = lcp->id;
|
||||
len = mg_ntohs(lcp->len);
|
||||
if (len < sizeof(*lcp) || len > lcpsz) return;
|
||||
switch (lcp->code) {
|
||||
case MG_PPP_LCP_CFG_REQ: {
|
||||
if (len == sizeof(*lcp)) {
|
||||
@@ -299,7 +300,7 @@ static void ppp_handle_ipcp(struct mg_tcpip_if *ifp, uint8_t *ipcpp,
|
||||
if (ipcpsz < sizeof(*ipcp)) return;
|
||||
id = ipcp->id;
|
||||
len = mg_ntohs(ipcp->len);
|
||||
if (len > ipcpsz) return;
|
||||
if (len < sizeof(*ipcp) || len > ipcpsz) return;
|
||||
switch (ipcp->code) {
|
||||
case MG_PPP_IPCP_CFG_REQ:
|
||||
MG_VERBOSE(("got IPCP config request, acknowledging..."));
|
||||
@@ -359,6 +360,7 @@ static void ppp_handle_ipv6cp(struct mg_tcpip_if *ifp, uint8_t *ipv6cpp,
|
||||
if (ipv6cpsz < sizeof(*ipv6cp)) return;
|
||||
id = ipv6cp->id;
|
||||
len = mg_ntohs(ipv6cp->len);
|
||||
if (len < sizeof(*ipv6cp) || len > ipv6cpsz) return;
|
||||
switch (ipv6cp->code) {
|
||||
case MG_PPP_IPV6CP_CFG_REQ:
|
||||
MG_VERBOSE(("got IPV6CP config request..."));
|
||||
|
||||
Reference in new issue
Block a user