Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit a908e2b

Browse files
committed
vallen is verified to be less than len, therefore, it can never
be the case that `vallen >= len + sizeof(rhostname)`. This PR fixes the check so the `rhostname` array does not overflow. Reported-by: Github Security Lab <securitylab@github.com> Signed-off-by: Alvaro Muñoz <pwntester@github.com>
1 parent 7d79ef3 commit a908e2b

File tree

1 file changed

+2
-2
lines changed
  • external/mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/netif/ppp

1 file changed

+2
-2
lines changed

external/mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/netif/ppp/lwip_eap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) {
14171417
}
14181418

14191419
/* Not so likely to happen. */
1420-
if (vallen >= len + sizeof (rhostname)) {
1420+
if (len - vallen >= sizeof (rhostname)) {
14211421
ppp_dbglog("EAP: trimming really long peer name down");
14221422
MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
14231423
rhostname[sizeof (rhostname) - 1] = '\0';
@@ -1845,7 +1845,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) {
18451845
}
18461846

18471847
/* Not so likely to happen. */
1848-
if (vallen >= len + sizeof (rhostname)) {
1848+
if (len - vallen >= sizeof (rhostname)) {
18491849
ppp_dbglog("EAP: trimming really long peer name down");
18501850
MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
18511851
rhostname[sizeof (rhostname) - 1] = '\0';

0 commit comments

Comments
 (0)