irrtoolset / irrtoolset

The Internet Routing Registry Toolset
Other
134 stars 33 forks source link

make rawhoisc and as a result `peval` multiple A and AAAA aware #54

Closed afpd closed 5 years ago

afpd commented 5 years ago

Patch to rawhoisc.cc makes rawhois class multiple A and AAAA records aware. Changes also fix a case when peval utility used on IPv6-only hosts.

nickhilliard commented 5 years ago

_port is of type signed int. If this were negative and very large, it could overflow char[10] by one byte. It would be better to use something like this::

sprintf(cport, "%hu", (unsigned short)_port);

You can then reduce cport down to size 6 = sizeof("65536") + 1.

Also, can you change the instances of fprintf(stderr, [...]); / exit(EXIT_FAILURE); to use error.Die and include useful information for debugging purposes (e.g. _host and cport)?