mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-23 20:11:49 +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;
|
if (lcpsz < sizeof(*lcp)) return;
|
||||||
id = lcp->id;
|
id = lcp->id;
|
||||||
len = mg_ntohs(lcp->len);
|
len = mg_ntohs(lcp->len);
|
||||||
|
if (len < sizeof(*lcp) || len > lcpsz) return;
|
||||||
switch (lcp->code) {
|
switch (lcp->code) {
|
||||||
case MG_PPP_LCP_CFG_REQ: {
|
case MG_PPP_LCP_CFG_REQ: {
|
||||||
if (len == sizeof(*lcp)) {
|
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;
|
if (ipcpsz < sizeof(*ipcp)) return;
|
||||||
id = ipcp->id;
|
id = ipcp->id;
|
||||||
len = mg_ntohs(ipcp->len);
|
len = mg_ntohs(ipcp->len);
|
||||||
if (len > ipcpsz) return;
|
if (len < sizeof(*ipcp) || len > ipcpsz) return;
|
||||||
switch (ipcp->code) {
|
switch (ipcp->code) {
|
||||||
case MG_PPP_IPCP_CFG_REQ:
|
case MG_PPP_IPCP_CFG_REQ:
|
||||||
MG_VERBOSE(("got IPCP config request, acknowledging..."));
|
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;
|
if (ipv6cpsz < sizeof(*ipv6cp)) return;
|
||||||
id = ipv6cp->id;
|
id = ipv6cp->id;
|
||||||
len = mg_ntohs(ipv6cp->len);
|
len = mg_ntohs(ipv6cp->len);
|
||||||
|
if (len < sizeof(*ipv6cp) || len > ipv6cpsz) return;
|
||||||
switch (ipv6cp->code) {
|
switch (ipv6cp->code) {
|
||||||
case MG_PPP_IPV6CP_CFG_REQ:
|
case MG_PPP_IPV6CP_CFG_REQ:
|
||||||
MG_VERBOSE(("got IPV6CP config request..."));
|
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;
|
if (lcpsz < sizeof(*lcp)) return;
|
||||||
id = lcp->id;
|
id = lcp->id;
|
||||||
len = mg_ntohs(lcp->len);
|
len = mg_ntohs(lcp->len);
|
||||||
|
if (len < sizeof(*lcp) || len > lcpsz) return;
|
||||||
switch (lcp->code) {
|
switch (lcp->code) {
|
||||||
case MG_PPP_LCP_CFG_REQ: {
|
case MG_PPP_LCP_CFG_REQ: {
|
||||||
if (len == sizeof(*lcp)) {
|
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;
|
if (ipcpsz < sizeof(*ipcp)) return;
|
||||||
id = ipcp->id;
|
id = ipcp->id;
|
||||||
len = mg_ntohs(ipcp->len);
|
len = mg_ntohs(ipcp->len);
|
||||||
if (len > ipcpsz) return;
|
if (len < sizeof(*ipcp) || len > ipcpsz) return;
|
||||||
switch (ipcp->code) {
|
switch (ipcp->code) {
|
||||||
case MG_PPP_IPCP_CFG_REQ:
|
case MG_PPP_IPCP_CFG_REQ:
|
||||||
MG_VERBOSE(("got IPCP config request, acknowledging..."));
|
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;
|
if (ipv6cpsz < sizeof(*ipv6cp)) return;
|
||||||
id = ipv6cp->id;
|
id = ipv6cp->id;
|
||||||
len = mg_ntohs(ipv6cp->len);
|
len = mg_ntohs(ipv6cp->len);
|
||||||
|
if (len < sizeof(*ipv6cp) || len > ipv6cpsz) return;
|
||||||
switch (ipv6cp->code) {
|
switch (ipv6cp->code) {
|
||||||
case MG_PPP_IPV6CP_CFG_REQ:
|
case MG_PPP_IPV6CP_CFG_REQ:
|
||||||
MG_VERBOSE(("got IPV6CP config request..."));
|
MG_VERBOSE(("got IPV6CP config request..."));
|
||||||
|
|||||||
Reference in new issue
Block a user