From 97d4b6c52e604d0a5a3953c245b21199e43eb320 Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Mon, 20 Apr 2020 11:32:59 +0200 Subject: [PATCH] socket-nif: Fix string argument passing for setsockopt When passing a string into setsockopt we have to use the pointer to the string, not a pointer to a pointer. Affects the socket bindtodevice and tcp congestion option. --- erts/emulator/nifs/common/prim_socket_nif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/emulator/nifs/common/prim_socket_nif.c b/erts/emulator/nifs/common/prim_socket_nif.c index cf01f710f57a..98756262820b 100644 --- a/erts/emulator/nifs/common/prim_socket_nif.c +++ b/erts/emulator/nifs/common/prim_socket_nif.c @@ -12394,7 +12394,7 @@ ERL_NIF_TERM esock_setopt_str_opt(ErlNifEnv* env, if (GET_STR(env, eVal, val, max) > 0) { int optLen = strlen(val); - int res = socket_setopt(descP->sock, level, opt, &val, optLen); + int res = socket_setopt(descP->sock, level, opt, val, optLen); if (res != 0) result = esock_make_error_errno(env, sock_errno());