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/stun-0.97~dfsg/udp.cxx
Examining data/stun-0.97~dfsg/tlsServer.cxx
Examining data/stun-0.97~dfsg/WinStun/WinStunDlg.h
Examining data/stun-0.97~dfsg/WinStun/WinStunDlg.cpp
Examining data/stun-0.97~dfsg/WinStun/WinStun.cpp
Examining data/stun-0.97~dfsg/WinStun/stdafx.cpp
Examining data/stun-0.97~dfsg/WinStun/resource.h
Examining data/stun-0.97~dfsg/WinStun/WinStun.h
Examining data/stun-0.97~dfsg/WinStun/stdafx.h
Examining data/stun-0.97~dfsg/client.cxx
Examining data/stun-0.97~dfsg/udp.h
Examining data/stun-0.97~dfsg/server.cxx
Examining data/stun-0.97~dfsg/stun.h
Examining data/stun-0.97~dfsg/stun.cxx

FINAL RESULTS:

data/stun-0.97~dfsg/stun.cxx:787:4:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
   strcat(buffer,hmacHex);
data/stun-0.97~dfsg/stun.cxx:985:4:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
   strcpy(response.errorCode.reason, msg);
data/stun-0.97~dfsg/stun.cxx:996:4:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
   strcpy(response.errorCode.reason, msg);
data/stun-0.97~dfsg/stun.cxx:681:39:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
#     error Need some way to seed the random number generator 
data/stun-0.97~dfsg/stun.cxx:685:7:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
      srand(seed);
data/stun-0.97~dfsg/stun.cxx:687:7:  [3] (random) srandom:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
      srandom(seed);
data/stun-0.97~dfsg/stun.cxx:700:11:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
   return random(); 
data/stun-0.97~dfsg/client.cxx:240: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.
         char buf[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:60: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(&nport, body, 2); body+=2;
data/stun-0.97~dfsg/stun.cxx:64: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(&naddr, body, 4); body+=4;
data/stun-0.97~dfsg/stun.cxx:92: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.value, body, 4);
data/stun-0.97~dfsg/stun.cxx:108: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.pad, body, 2); body+=2;
data/stun-0.97~dfsg/stun.cxx:114: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.reason, body, result.sizeReason);
data/stun-0.97~dfsg/stun.cxx:133:10:  [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.attrType[i], body, 2); body+=2;
data/stun-0.97~dfsg/stun.cxx:158: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.value, body, hdrLen);
data/stun-0.97~dfsg/stun.cxx:175: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.hash, body, hdrLen);
data/stun-0.97~dfsg/stun.cxx:193:4:  [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(&msg.msgHdr, buf, sizeof(StunMsgHdr));
data/stun-0.97~dfsg/stun.cxx:443:4:  [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, reinterpret_cast<void*>(&ndata), sizeof(UInt16));
data/stun-0.97~dfsg/stun.cxx:451:4:  [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, reinterpret_cast<void*>(&ndata), sizeof(UInt32));
data/stun-0.97~dfsg/stun.cxx:459:4:  [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, data, length);
data/stun-0.97~dfsg/stun.cxx:677: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("/dev/random",O_RDONLY);
data/stun-0.97~dfsg/stun.cxx:770:4:  [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 buffer[1024];
data/stun-0.97~dfsg/stun.cxx:771:4:  [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(buffer,
data/stun-0.97~dfsg/stun.cxx:780:4:  [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 hmac[20];
data/stun-0.97~dfsg/stun.cxx:783:4:  [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 hmacHex[41];
data/stun-0.97~dfsg/stun.cxx:794:4:  [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(username->value,buffer,l);
data/stun-0.97~dfsg/stun.cxx:803:4:  [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 hmac[20];
data/stun-0.97~dfsg/stun.cxx:869:4:  [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 host[512];
data/stun-0.97~dfsg/stun.cxx:1099:31:  [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 hmac[20];
data/stun-0.97~dfsg/stun.cxx:1199:13:  [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( resp->username.value, req.username.value, req.username.sizeValue );
data/stun-0.97~dfsg/stun.cxx:1211:13:  [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( resp->serverName.value, serverName, sizeof(serverName));
data/stun-0.97~dfsg/stun.cxx:1352:4:  [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 msg[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:1431:19:  [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 msg[MAX_RTP_MSG_SIZE];
data/stun-0.97~dfsg/stun.cxx:1574:7:  [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[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:1639:4:  [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[ len ];
data/stun-0.97~dfsg/stun.cxx:1775:4:  [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[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:1841:4:  [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 msg[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:2024:19:  [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 msg[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:2270:4:  [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 msg[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.cxx:2332:4:  [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 msg[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/stun.h:25:27:  [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.
typedef struct { unsigned char octet[16]; }  UInt128;
data/stun-0.97~dfsg/stun.h:101:7:  [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 reason[STUN_MAX_STRING];
data/stun-0.97~dfsg/stun.h:113:7:  [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 value[STUN_MAX_STRING];      
data/stun-0.97~dfsg/stun.h:119:7:  [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 hash[20];
data/stun-0.97~dfsg/tlsServer.cxx:152:15:  [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* fp = fopen("id.pem","rb");
data/stun-0.97~dfsg/tlsServer.cxx:166:9:  [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).
   fp = fopen("id_key.pem","rb");
data/stun-0.97~dfsg/tlsServer.cxx:326:13:  [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[256];
data/stun-0.97~dfsg/tlsServer.cxx:346:16:  [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[STUN_MAX_MESSAGE_SIZE];
data/stun-0.97~dfsg/tlsServer.cxx:363:25:  [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[256];
data/stun-0.97~dfsg/client.cxx:265:13:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
            usleep(10*1000);
data/stun-0.97~dfsg/stun.cxx:678:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      read(fd,&tick,sizeof(tick));
data/stun-0.97~dfsg/stun.cxx:724:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120). Risk is low because the source is a
  constant string.
   strncpy(hmac,"hmac-not-implemented",20);
data/stun-0.97~dfsg/stun.cxx:776:12:  [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).
   assert( strlen(buffer) < 1024 );
data/stun-0.97~dfsg/stun.cxx:778: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).
   assert(strlen(buffer) + 41 < STUN_MAX_STRING);
data/stun-0.97~dfsg/stun.cxx:782:30:  [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).
   computeHmac(hmac, buffer, strlen(buffer), key, strlen(key) );
data/stun-0.97~dfsg/stun.cxx:782:51:  [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).
   computeHmac(hmac, buffer, strlen(buffer), key, strlen(key) );
data/stun-0.97~dfsg/stun.cxx:789:12:  [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).
   int l = strlen(buffer);
data/stun-0.97~dfsg/stun.cxx:806:38:  [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).
   computeHmac(hmac, username.value, strlen(username.value), key, strlen(key));
data/stun-0.97~dfsg/stun.cxx:806:67:  [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).
   computeHmac(hmac, username.value, strlen(username.value), key, strlen(key));
data/stun-0.97~dfsg/stun.cxx:870:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
   strncpy(host,peerName,512);
data/stun-0.97~dfsg/stun.cxx:909:12:  [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).
   assert( strlen(host) >= 1 );
data/stun-0.97~dfsg/stun.cxx:1793:4:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
		 usleep(10*1000);
data/stun-0.97~dfsg/tlsServer.cxx:249:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      fd_set read;
data/stun-0.97~dfsg/tlsServer.cxx:250:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      FD_ZERO(&read);
data/stun-0.97~dfsg/tlsServer.cxx:253:20:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      FD_SET(mFd, &read);
data/stun-0.97~dfsg/tlsServer.cxx:260:28:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            FD_SET(fd[i], &read); 
data/stun-0.97~dfsg/tlsServer.cxx:272:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      int e = select(size, &read, NULL, NULL, &tv);
data/stun-0.97~dfsg/tlsServer.cxx:277:27:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      if ( FD_ISSET(mFd, &read))
data/stun-0.97~dfsg/tlsServer.cxx:342:37:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if (  FD_ISSET( fd[i], &read) ||  SSL_pending(ssl[i])  )

ANALYSIS SUMMARY:

Hits = 69
Lines analyzed = 5048 in approximately 0.12 seconds (41250 lines/second)
Physical Source Lines of Code (SLOC) = 3674
Hits@level = [0]   2 [1]  20 [2]  42 [3]   4 [4]   3 [5]   0
Hits@level+ = [0+]  71 [1+]  69 [2+]  49 [3+]   7 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 19.325 [1+] 18.7806 [2+] 13.337 [3+] 1.90528 [4+] 0.816549 [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.