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/didiwiki-0.5/src/wiki.h
Examining data/didiwiki-0.5/src/util.c
Examining data/didiwiki-0.5/src/util.h
Examining data/didiwiki-0.5/src/wikitext.h
Examining data/didiwiki-0.5/src/didi.h
Examining data/didiwiki-0.5/src/didi.c
Examining data/didiwiki-0.5/src/http.c
Examining data/didiwiki-0.5/src/http.h
Examining data/didiwiki-0.5/src/wiki.c

FINAL RESULTS:

data/didiwiki-0.5/src/http.c:344:7:  [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(res->extra_headers, header);
data/didiwiki-0.5/src/wiki.c:674:34:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
      if (S_ISREG(st.st_mode) && access(namelist[n]->d_name, R_OK) == 0)
data/didiwiki-0.5/src/wiki.c:852:45:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    if (page && page_name_is_good(page) && (access(page, R_OK) == 0))
data/didiwiki-0.5/src/wiki.c:895:45:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
    if (page && page_name_is_good(page) && (access(page, R_OK) == 0))
data/didiwiki-0.5/src/wiki.c:953:11:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
      if (access("WikiHome", R_OK) != 0)
data/didiwiki-0.5/src/wiki.c:1035:11:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
      if (access(page, R_OK) == 0) 	/* page exists */
data/didiwiki-0.5/src/wiki.c:1111:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
  if (access("WikiHelp", R_OK) != 0) 
data/didiwiki-0.5/src/wiki.c:1114:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
  if (access("WikiHome", R_OK) != 0) 
data/didiwiki-0.5/src/wiki.c:1119:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
  if (access("styles.css", R_OK) == 0) 
data/didiwiki-0.5/src/didi.c:47:11:  [3] (buffer) getopt_long:
  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.
      c = getopt_long (argc, argv, "dl:p:h:", long_options, &option_index);
data/didiwiki-0.5/src/http.c:287:7:  [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 (getenv("QUERY_STRING"))
data/didiwiki-0.5/src/http.c:288:45:  [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.
    http_request_parse_params (req, strdup((getenv("QUERY_STRING"))), '&'); 
data/didiwiki-0.5/src/http.c:292:18:  [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.
  content_type = getenv("CONTENT_TYPE");
data/didiwiki-0.5/src/http.c:293:9:  [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.
  len = getenv("CONTENT_LENGTH") ? atoi(getenv("CONTENT_LENGTH")) : 0;
data/didiwiki-0.5/src/http.c:293:41:  [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.
  len = getenv("CONTENT_LENGTH") ? atoi(getenv("CONTENT_LENGTH")) : 0;
data/didiwiki-0.5/src/http.c:308:7:  [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 (getenv("HTTP_COOKIE"))
data/didiwiki-0.5/src/http.c:309:45:  [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.
    http_request_parse_params (req, strdup((getenv("HTTP_COOKIE"))), '&'); 
data/didiwiki-0.5/src/wiki.c:1081:11:  [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 (getenv("DIDIWIKIHOME"))
data/didiwiki-0.5/src/wiki.c:1083:33:  [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.
	  snprintf(datadir, 512, "%s", getenv("DIDIWIKIHOME"));
data/didiwiki-0.5/src/wiki.c:1087:8:  [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 (getenv("HOME") == NULL)
data/didiwiki-0.5/src/wiki.c:1093:43:  [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.
	  snprintf(datadir, 512, "%s/.didiwiki", getenv("HOME"));
data/didiwiki-0.5/src/didi.c:63:11:  [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).
	  port = atoi(optarg);
data/didiwiki-0.5/src/http.c:192: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               request_line[2048];     /* A single line of input. */
data/didiwiki-0.5/src/http.c:293:36:  [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).
  len = getenv("CONTENT_LENGTH") ? atoi(getenv("CONTENT_LENGTH")) : 0;
data/didiwiki-0.5/src/http.c:374:2:  [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(res->data + res->data_len - 1, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:376:2:  [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(res->data, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:381: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(res->data, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:387: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(res->data + res->data_len - 1, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/util.c:207:1:  [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 urienc[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
data/didiwiki-0.5/src/wiki.c:165:14:  [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).
  if (!(fp = fopen(filename, "rb"))) 
data/didiwiki-0.5/src/wiki.c:185:14:  [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).
  if (!(fp = fopen(filename, "wb"))) 
data/didiwiki-0.5/src/wiki.c:709: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   datebuf[64];
data/didiwiki-0.5/src/wiki.c:918: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   datebuf[64];
data/didiwiki-0.5/src/wiki.c:1060: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.
	      char buf[1024];
data/didiwiki-0.5/src/wiki.c:1072: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 datadir[512] = { 0 };
data/didiwiki-0.5/src/http.c:252: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).
      i = strlen(val);
data/didiwiki-0.5/src/http.c:343:6:  [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).
		   strlen(res->extra_headers) + strlen(header) + 1);
data/didiwiki-0.5/src/http.c:343:35:  [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).
		   strlen(res->extra_headers) + strlen(header) + 1);
data/didiwiki-0.5/src/http.c:371:24:  [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).
  if ((res->data_len + strlen(tmp) + 1) < res->data_len_alloced)
data/didiwiki-0.5/src/http.c:374:45:  [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).
	memcpy(res->data + res->data_len - 1, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:376:25:  [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).
	memcpy(res->data, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:380:26:  [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).
      res->data = malloc(strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:381: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).
      memcpy(res->data, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:382: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).
      res->data_len_alloced = strlen(tmp)+1;
data/didiwiki-0.5/src/http.c:386:55:  [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).
      res->data = realloc( res->data, res->data_len + strlen(tmp) );
data/didiwiki-0.5/src/http.c:387:50:  [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).
      memcpy(res->data + res->data_len - 1, tmp, strlen(tmp)+1);
data/didiwiki-0.5/src/http.c:388:47:  [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).
      res->data_len_alloced = res->data_len + strlen(tmp);
data/didiwiki-0.5/src/http.c:391: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).
  res->data_len = strlen(res->data)+1;      
data/didiwiki-0.5/src/util.c:140:17:  [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).
  if( n<0 ) n = strlen(in);
data/didiwiki-0.5/src/wiki.c:111:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy(url, start, p - start);
data/didiwiki-0.5/src/wiki.c:117:17:  [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 len = strlen(url);
data/didiwiki-0.5/src/wiki.c:183: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).
  int         len           = strlen(data)+1;
data/didiwiki-0.5/src/wiki.c:563:22:  [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   header_len = strlen(location_enc) + 14; 
data/didiwiki-0.5/src/wiki.c:585:42:  [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).
  http_response_printf_alloc_buffer(res, strlen(wikitext)*2);
data/didiwiki-0.5/src/wiki.c:589:48:  [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).
  html_clean_wikitext = util_htmlize(wikitext, strlen(wikitext));
data/didiwiki-0.5/src/wiki.c:730:23:  [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).
  if (expr == NULL || strlen(expr) == 0)

ANALYSIS SUMMARY:

Hits = 56
Lines analyzed = 2550 in approximately 0.13 seconds (19089 lines/second)
Physical Source Lines of Code (SLOC) = 1849
Hits@level = [0]  36 [1]  21 [2]  14 [3]  12 [4]   9 [5]   0
Hits@level+ = [0+]  92 [1+]  56 [2+]  35 [3+]  21 [4+]   9 [5+]   0
Hits/KSLOC@level+ = [0+] 49.7566 [1+] 30.2866 [2+] 18.9292 [3+] 11.3575 [4+] 4.8675 [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.