1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-27 15:43:17 +00:00

Fix unitialized memory access in net/ module.

This commit is contained in:
Calvin Rose 2021-11-18 20:10:10 -06:00
parent 6f7e81067c
commit bc9ec7ac4a

View File

@ -380,7 +380,7 @@ JANET_CORE_FN(cfun_net_connect,
int is_unix = 0; int is_unix = 0;
char *bindhost = (char *) janet_optcstring(argv, argc, 3, NULL); char *bindhost = (char *) janet_optcstring(argv, argc, 3, NULL);
char *bindport = NULL; char *bindport = NULL;
if (janet_checkint(argv[4])) { if (argc >= 5 && janet_checkint(argv[4])) {
bindport = (char *)janet_to_string(argv[4]); bindport = (char *)janet_to_string(argv[4]);
} else { } else {
bindport = (char *)janet_optcstring(argv, argc, 4, NULL); bindport = (char *)janet_optcstring(argv, argc, 4, NULL);