mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-23 23:22:55 -05:00
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:
commit
a814fe8c5f
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue