8000 ARES_SOCKET_OPT_BIND_DEVICE only validate printable up to NULL terminator by bradh352 · Pull Request #935 · c-ares/c-ares · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ARES_SOCKET_OPT_BIND_DEVICE only validate printable up to NULL terminator #935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lib/ares_set_socket_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ static int default_asetsockopt(ares_socket_t sock, ares_socket_opt_t opt,
return setsockopt(sock, SOL_SOCKET, SO_RCVBUF, val, val_size);

case ARES_SOCKET_OPT_BIND_DEVICE:
if (!ares_str_isprint(val, (size_t)val_size)) {
/* Count the number of characters before NULL terminator then
* validate those are all printable */
if (!ares_str_isprint(val, ares_strnlen(val, (size_t)val_size))) {
SET_SOCKERRNO(EINVAL);
return -1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ares_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ ares_status_t ares_socket_configure(ares_channel_t *channel, int family,
* compatibility */
(void)channel->sock_funcs.asetsockopt(
fd, ARES_SOCKET_OPT_BIND_DEVICE, channel->local_dev_name,
ares_strlen(channel->local_dev_name), channel->sock_func_cb_data);
(ares_socklen_t)ares_strlen(channel->local_dev_name),
channel->sock_func_cb_data);
}

/* Bind to ip address if configured */
Expand Down
Loading
0