Skip to content

Commit

Permalink
ARES_SOCKET_OPT_BIND_DEVICE only validate printable up to NULL termin…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
bradh352 committed Dec 12, 2024
1 parent 608507d commit 090c852
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 090c852

Please sign in to comment.