Merge pull request #1040 from xiaoxiaoafeifei/master

fix heap-buffer-overflow issue in function cfg_mark_ports of file util/config_file.c
This commit is contained in:
Wouter Wijngaards 2024-04-03 10:02:45 +02:00 committed by GitHub
commit a814fe8c5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1761,6 +1761,10 @@ cfg_mark_ports(const char* str, int allow, int* avail, int num)
#endif
if(!mid) {
int port = atoi(str);
if(port < 0) {
log_err("Prevent out-of-bounds access to array avail");
return 0;
}
if(port == 0 && strcmp(str, "0") != 0) {
log_err("cannot parse port number '%s'", str);
return 0;