Skip to content

Commit 193401e

Browse files
fix heap-buffer-overflow issue in function cfg_mark_ports of file util/config_file.c
1 parent e1aeabd commit 193401e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

util/config_file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,10 @@ cfg_mark_ports(const char* str, int allow, int* avail, int num)
17611761
#endif
17621762
if(!mid) {
17631763
int port = atoi(str);
1764+
if(port < 0) {
1765+
log_err("Prevent out-of-bounds access to array avail");
1766+
return 0;
1767+
}
17641768
if(port == 0 && strcmp(str, "0") != 0) {
17651769
log_err("cannot parse port number '%s'", str);
17661770
return 0;

0 commit comments

Comments
 (0)