Skip to content

Commit

Permalink
socket-nif: Fix string argument passing for setsockopt
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RoadRunnr committed Apr 20, 2020
1 parent f81f56e commit 97d4b6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion erts/emulator/nifs/common/prim_socket_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 97d4b6c

Please sign in to comment.