fix: array icmp_advert_entry_addr may out of bound

when proxy_count=128, array icmp_advert_entry_addr and icmp_advert_entry_pref will out of bound.
This commit is contained in:
neo-one0873 2023-06-27 17:54:28 +08:00 committed by GitHub
parent d131a096a8
commit bcd8efb926
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1895,7 +1895,7 @@ bool NpingOps::issetICMPTransmitTimestamp(){
int NpingOps::addICMPAdvertEntry(struct in_addr addr, u32 pref ){
if( this->icmp_advert_entry_count > MAX_ICMP_ADVERT_ENTRIES )
if( this->icmp_advert_entry_count >= MAX_ICMP_ADVERT_ENTRIES )
return OP_FAILURE;
this->icmp_advert_entry_addr[this->icmp_advert_entry_count] = addr;
this->icmp_advert_entry_pref[this->icmp_advert_entry_count] = pref;