sustrik / libdill

Structured concurrency in C
MIT License
1.68k stars 156 forks source link

ipaddr_remote segfaults on domain names, not actually tested? #224

Open wusspuss opened 1 year ago

wusspuss commented 1 year ago

Adaptation from the tutorial:

#include <libdill.h>
#include <stdio.h>

int main() {
  struct ipaddr addr;
  int rc = ipaddr_remote(&addr, "example.org", 80, 0, -1);
  if (rc != 0) {
    printf("rc=%i,errno=%i\n",rc,errno);
    return 1;
  }

  return 0;
}

Sometimes prints rc=-1,errno=99 (not a valid errno), sometimes segfaults straight away. If you swap "example.org" for "127.0.0.1" it works just fine. From grepping tests/ for ipaddr_remote it seems it's only tested for 0.0.0.0 and 127.0.0.1 and not domain names.