X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fnames-net.c;h=14141f4c2be879cd6d96e740422f3acea16d9579;hb=f87084246bceb65947d320bd5d53f35d14619b44;hp=d14949115f35c62c4c24f6c3ad0a96d066f6866d;hpb=25cc4350661290538bdc0eb9932600309fd603f3;p=pciutils.git diff --git a/lib/names-net.c b/lib/names-net.c index d149491..14141f4 100644 --- a/lib/names-net.c +++ b/lib/names-net.c @@ -3,20 +3,32 @@ * * Copyright (c) 2007--2008 Martin Mares * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ #include #include +#include #include "internal.h" #include "names.h" #ifdef PCI_USE_DNS +/* + * Our definition of BYTE_ORDER confuses arpa/nameser_compat.h on + * Solaris so we must undef it before including arpa/nameser.h. + */ +#ifdef PCI_OS_SUNOS +#undef BYTE_ORDER +#endif + #include #include #include +#include /* * Unfortunately, there are no portable functions for DNS RR parsing, @@ -74,7 +86,8 @@ static int dns_parse_packet(struct dns_state *s, byte *p, unsigned int plen) { byte *end = p + plen; - unsigned int i, j, x, len; + unsigned int i, j, len; + unsigned int UNUSED x; #if 0 /* Dump the packet */ @@ -185,7 +198,7 @@ char default: return NULL; } - sprintf(dnsname, "%s.%s", name, domain); + sprintf(dnsname, "%.100s.%.100s", name, domain); a->debug("Resolving %s\n", dnsname); if (!resolver_inited) @@ -196,7 +209,7 @@ char res = res_query(dnsname, ns_c_in, ns_t_txt, answer, sizeof(answer)); if (res < 0) { - a->debug("\tfailed, h_errno=%d\n", _res.res_h_errno); + a->debug("\tfailed, h_errno=%d\n", h_errno); return NULL; } if (dns_parse_packet(&ds, answer, res) < 0)