Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler.
Number of rules (primarily dangerous function names) in C/C++ ruleset: 223
Examining data/udns-0.4/udns.h
Examining data/udns-0.4/udns_dn.c
Examining data/udns-0.4/udns_dntosp.c
Examining data/udns-0.4/udns_parse.c
Examining data/udns-0.4/udns_resolver.c
Examining data/udns-0.4/udns_init.c
Examining data/udns-0.4/udns_misc.c
Examining data/udns-0.4/udns_XtoX.c
Examining data/udns-0.4/udns_rr_a.c
Examining data/udns-0.4/udns_rr_ptr.c
Examining data/udns-0.4/udns_rr_mx.c
Examining data/udns-0.4/udns_rr_txt.c
Examining data/udns-0.4/udns_bl.c
Examining data/udns-0.4/udns_rr_srv.c
Examining data/udns-0.4/udns_rr_naptr.c
Examining data/udns-0.4/udns_codes.c
Examining data/udns-0.4/udns_jran.c
Examining data/udns-0.4/dnsget.c
Examining data/udns-0.4/rblcheck.c
Examining data/udns-0.4/ex-rdns.c
Examining data/udns-0.4/inet_XtoX.c
Examining data/udns-0.4/getopt.c

FINAL RESULTS:

data/udns-0.4/dnsget.c:69:22:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap);
data/udns-0.4/dnsget.c:247:24:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
      if (verbose > 0) printf(n++ ? "\" \"":"\"");
data/udns-0.4/rblcheck.c:53:22:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
  va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap);
data/udns-0.4/rblcheck.c:342:7:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
      sprintf(path, "%s/.rblcheckrc", home);
data/udns-0.4/dnsget.c:588:14:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while((i = getopt(argc, argv, "vqt:c:an:o:f:h")) != EOF) switch(i) {
data/udns-0.4/ex-rdns.c:71:14:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while((c = getopt(argc, argv, "m:r")) != EOF) switch(c) {
data/udns-0.4/getopt.c:38:10:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
# define getopt my_getopt
data/udns-0.4/getopt.c:89:18:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
GETOPT_CLASS int getopt(int argc, char *const *argv, const char *opts) {
data/udns-0.4/getopt.c:151:14:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while((c = getopt(argc, argv, "ab:c::")) != -1) switch(c) {
data/udns-0.4/inet_XtoX.c:294:14:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while((i = getopt(argc, argv, "46a:p:")) != EOF) switch(i) {
data/udns-0.4/rblcheck.c:293:14:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
  while((c = getopt(argc, argv, "hqtvms:S:cn:")) != EOF) switch(c) {
data/udns-0.4/rblcheck.c:329:15:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    char *s = getenv("RBLCHECK_ZONES");
data/udns-0.4/rblcheck.c:339:20:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
      char *home = getenv("HOME");
data/udns-0.4/udns_init.c:78:16:  [3] (misc) LoadLibrary:
  Ensure that the full path to the library is specified, or current directory
  may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to
  find library path, if you aren't already.
  h_iphlpapi = LoadLibrary("iphlpapi.dll");
data/udns-0.4/udns_init.c:189:12:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  if ((v = getenv("NSCACHEIP")) != NULL ||
data/udns-0.4/udns_init.c:190:12:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
      (v = getenv("NAMESERVERS")) != NULL) {
data/udns-0.4/udns_init.c:195:12:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  if ((v = getenv("LOCALDOMAIN")) != NULL) {
data/udns-0.4/udns_init.c:200:12:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
  if ((v = getenv("RES_OPTIONS")) != NULL)
data/udns-0.4/dnsget.c:77:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  static char buf[6*5+4*4];
data/udns-0.4/dnsget.c:98:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(cdn, dn, l);
data/udns-0.4/dnsget.c:513:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char dn[DNS_MAXDN];
data/udns-0.4/dnsget.c:569:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char *ns[DNS_MAXSERV];
data/udns-0.4/dnsget.c:721:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char dn[DNS_MAXDN];
data/udns-0.4/ex-rdns.c:39:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  static char b[sizeof("255.255.255.255")];
data/udns-0.4/ex-rdns.c:40:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(b, "%u.%u.%u.%u", c[0], c[1], c[2], c[3]);
data/udns-0.4/ex-rdns.c:63:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char linebuf[1024];
data/udns-0.4/ex-rdns.c:72:20:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
  case 'm': maxq = atoi(optarg); break;
data/udns-0.4/getopt.c:58:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char buf[64];
data/udns-0.4/getopt.c:67:7:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
      memcpy(buf, argv[0], ml);
data/udns-0.4/getopt.c:71:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(p, msg, ml); p += ml;
data/udns-0.4/inet_XtoX.c:52:12:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  unsigned char x[4];
data/udns-0.4/inet_XtoX.c:95:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  static char hex[16] = "0123456789abcdef";
data/udns-0.4/inet_XtoX.c:163:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  static char buf[4*4];
data/udns-0.4/inet_XtoX.c:287:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char n0[16], n1[16];
data/udns-0.4/inet_XtoX.c:288:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char p0[64], p1[64];
data/udns-0.4/inet_XtoX.c:297:28:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
  case 'a': case 'p': pl = atoi(optarg); break;
data/udns-0.4/rblcheck.c:104:7:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
      memcpy(zs, zones, nzones * sizeof(char*));
data/udns-0.4/rblcheck.c:113:13:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  FILE *f = fopen(fname, "r");
data/udns-0.4/rblcheck.c:114:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char linebuf[2048];
data/udns-0.4/rblcheck.c:125:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    p = memcpy(ecalloc(e - p, 1), p, e - p); // strdup
data/udns-0.4/rblcheck.c:133:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[4*4];
data/udns-0.4/rblcheck.c:143:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[4*4];
data/udns-0.4/udns_bl.c:115:21:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
dns_rhsbltodn(const char *name, const char *rhsbl, dnsc_t dn[DNS_MAXDN])
data/udns-0.4/udns_bl.c:115:39:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
dns_rhsbltodn(const char *name, const char *rhsbl, dnsc_t dn[DNS_MAXDN])
data/udns-0.4/udns_codes.c:73:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
 static char nm[20];
data/udns-0.4/udns_codes.c:153:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
 static char nm[20];
data/udns-0.4/udns_codes.c:181:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
 static char nm[20];
data/udns-0.4/udns_dn.c:62:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(ddn, sdn, sdnlen);
data/udns-0.4/udns_dn.c:187:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(p, tdn, l);
data/udns-0.4/udns_dn.c:231:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(p, tdn, l);
data/udns-0.4/udns_dn.c:347:21:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
  sz = (argc > 1) ? atoi(argv[1]) : 0;
data/udns-0.4/udns_dntosp.c:26:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char name[DNS_MAXNAME];
data/udns-0.4/udns_init.c:115:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char valBuf[1024];
data/udns-0.4/udns_init.c:146:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char buf[2049];	/* this buffer is used to hold /etc/resolv.conf */
data/udns-0.4/udns_init.c:150:14:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  { int fd = open("/etc/resolv.conf", O_RDONLY);
data/udns-0.4/udns_parse.c:83:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(dp, pp, c);		/* and the label itself */
data/udns-0.4/udns_resolver.c:532:9:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        memcpy(sin6.sin6_addr.s6_addr + 4*3, &sns->sin.sin_addr, 4);
data/udns-0.4/udns_resolver.c:740:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(q->dnsq_dn + q->dnsq_origdnl0, q->dnsq_nxtsrch, dnl);
data/udns-0.4/udns_resolver.c:779:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(p + DNS_H_QID, q->dnsq_id, 2);
data/udns-0.4/udns_resolver.c:784:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(p, q->dnsq_typcls, 4); p += 4;
data/udns-0.4/udns_resolver.c:1125:7:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
      memcpy(result, pbuf, r);
data/udns-0.4/udns_rr_a.c:69:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(ret->dnsa_addr + dsize * r, rr.dnsrr_dptr, dsize);
data/udns-0.4/udns_rr_naptr.c:42:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(buf, cp, l);
data/udns-0.4/udns_rr_txt.c:74:7:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
      memcpy(sp, cp, l);
data/udns-0.4/dnsget.c:736:31:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    else if (!dns_ptodn(name, strlen(name), dn, sizeof(dn), &abs))
data/udns-0.4/getopt.c:59:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    unsigned pl = strlen(argv[0]);
data/udns-0.4/getopt.c:60:19:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    unsigned ml = strlen(msg);
data/udns-0.4/rblcheck.c:341:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      path = malloc(strlen(home) + 1 + sizeof(".rblcheckrc"));
data/udns-0.4/udns_dn.c:74:43:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  dnscc_t *ne = np + (namelen ? namelen : strlen((char*)np));
data/udns-0.4/udns_init.c:152:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      int l = read(fd, buf, sizeof(buf) - 1);
data/udns-0.4/udns_init.c:191:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(buf, v, sizeof(buf) - 1);
data/udns-0.4/udns_init.c:196:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(buf, v, sizeof(buf) - 1);
data/udns-0.4/udns_resolver.c:281:11:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      v = strlen(dns_opts[i].name);

ANALYSIS SUMMARY:

Hits = 73
Lines analyzed = 5885 in approximately 0.21 seconds (27466 lines/second)
Physical Source Lines of Code (SLOC) = 4438
Hits@level = [0] 105 [1]   9 [2]  46 [3]  14 [4]   4 [5]   0
Hits@level+ = [0+] 178 [1+]  73 [2+]  64 [3+]  18 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 40.1082 [1+] 16.4489 [2+] 14.4209 [3+] 4.05588 [4+] 0.901307 [5+]   0
Dot directories skipped = 1 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.