mirror of
https://github.com/armfly/H7-TOOL_STM32H7_App.git
synced 2024-08-09 10:05:34 +08:00
Merge pull request #24 from ghsecuritylab/fix/GSL/prevent_rhostname_overflow
[SECURITY] Prevent `rhostname` array overflow
This commit is contained in:
commit
eab4928d70
@ -1417,7 +1417,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) {
|
||||
}
|
||||
|
||||
/* Not so likely to happen. */
|
||||
if (vallen >= len + sizeof (rhostname)) {
|
||||
if (len - vallen >= sizeof (rhostname)) {
|
||||
ppp_dbglog("EAP: trimming really long peer name down");
|
||||
MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
|
||||
rhostname[sizeof (rhostname) - 1] = '\0';
|
||||
@ -1845,7 +1845,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) {
|
||||
}
|
||||
|
||||
/* Not so likely to happen. */
|
||||
if (vallen >= len + sizeof (rhostname)) {
|
||||
if (len - vallen >= sizeof (rhostname)) {
|
||||
ppp_dbglog("EAP: trimming really long peer name down");
|
||||
MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
|
||||
rhostname[sizeof (rhostname) - 1] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user