Skip to content

Commit

Permalink
fix: resolve_bootstrap_node() not checking net_getipport() returned c…
Browse files Browse the repository at this point in the history
…ount correctly

doc: improve inline docu of return of net_getipport
  • Loading branch information
Green-Sky committed Jan 3, 2023
1 parent d222d70 commit 88ffd1a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion other/bootstrap_daemon/docker/tox-bootstrapd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1fadb7de1ccf46186e33c13343e2c67f4c84e78fadfbfbbc8f3ce70e670907f2 /usr/local/bin/tox-bootstrapd
3d28c914487efaae4336af17b221049c73249fb917d672f5ae6d9c092522a24f /usr/local/bin/tox-bootstrapd
5 changes: 3 additions & 2 deletions toxcore/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,9 @@ bool net_connect(const Logger *log, Socket sock, const IP_Port *ip_port);
* Skip all addresses with socktype != type (use type = -1 to get all addresses)
* To correctly deallocate array memory use `net_freeipport()`
*
* return number of elements in res array
* and -1 on error.
* @return number of elements in res array.
* @retval 0 if res array empty.
* @retval -1 on error.
*/
non_null()
int32_t net_getipport(const char *node, IP_Port **res, int tox_type);
Expand Down
2 changes: 1 addition & 1 deletion toxcore/tox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ static int32_t resolve_bootstrap_node(Tox *tox, const char *host, uint16_t port,

const int32_t count = net_getipport(host, root, TOX_SOCK_DGRAM);

if (count == -1) {
if (count < 1) {
LOGGER_DEBUG(tox->m->log, "could not resolve bootstrap node '%s'", host);
net_freeipport(*root);
SET_ERROR_PARAMETER(error, TOX_ERR_BOOTSTRAP_BAD_HOST);
Expand Down

0 comments on commit 88ffd1a

Please sign in to comment.