Skip to content

Commit

Permalink
fix heap-buffer-overflow issue in function cfg_mark_ports of file uti…
Browse files Browse the repository at this point in the history
…l/config_file.c
  • Loading branch information
xiaoxiaoafeifei committed Apr 3, 2024
1 parent e1aeabd commit 193401e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util/config_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 193401e

Please sign in to comment.