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/libxdg-basedir-1.2.0/tests/testfind.c
Examining data/libxdg-basedir-1.2.0/tests/testquery.c
Examining data/libxdg-basedir-1.2.0/tests/testdump.c
Examining data/libxdg-basedir-1.2.0/include/basedir.h
Examining data/libxdg-basedir-1.2.0/include/basedir_fs.h
Examining data/libxdg-basedir-1.2.0/src/basedir.c

FINAL RESULTS:

data/libxdg-basedir-1.2.0/src/basedir.c:250:3:  [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(item, env);
data/libxdg-basedir-1.2.0/src/basedir.c:267: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(item, defaults[i]);
data/libxdg-basedir-1.2.0/src/basedir.c:460:3:  [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(fullPath, *item);
data/libxdg-basedir-1.2.0/src/basedir.c:462: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(fullPath, DIR_SEPARATOR_STR);
data/libxdg-basedir-1.2.0/src/basedir.c:463:3:  [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(fullPath, relativePath);
data/libxdg-basedir-1.2.0/src/basedir.c:474: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(&returnString[strLen], fullPath);
data/libxdg-basedir-1.2.0/src/basedir.c:506:3:  [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(fullPath, *item);
data/libxdg-basedir-1.2.0/src/basedir.c:508: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(fullPath, DIR_SEPARATOR_STR);
data/libxdg-basedir-1.2.0/src/basedir.c:509:3:  [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(fullPath, relativePath);
data/libxdg-basedir-1.2.0/src/basedir.c:533:2:  [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(tmpPath, path);
data/libxdg-basedir-1.2.0/src/basedir.c:246: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.
	env = getenv(name);
data/libxdg-basedir-1.2.0/src/basedir.c:281:14:  [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 *env = getenv(name);
data/libxdg-basedir-1.2.0/src/basedir.c:330: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(value, homeenv, homelen+1);
data/libxdg-basedir-1.2.0/src/basedir.c:334: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(value+homelen, DefaultRelativeDataHome, sizeof(DefaultRelativeDataHome));
data/libxdg-basedir-1.2.0/src/basedir.c:340: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(value+homelen, DefaultRelativeConfigHome, sizeof(DefaultRelativeConfigHome));
data/libxdg-basedir-1.2.0/src/basedir.c:346: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(value+homelen, DefaultRelativeCacheHome, sizeof(DefaultRelativeCacheHome));
data/libxdg-basedir-1.2.0/src/basedir.c:386: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(dirlist+!!homedir, envlist, sizeof(char*)*(size+1));
data/libxdg-basedir-1.2.0/src/basedir.c:464: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).
		testFile = fopen(fullPath, "r");
data/libxdg-basedir-1.2.0/src/basedir.c:510: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).
		testFile = fopen(fullPath, mode);
data/libxdg-basedir-1.2.0/src/basedir.c:578: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(relhome, home, homelen);
data/libxdg-basedir-1.2.0/src/basedir.c:579: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(relhome+homelen, relativefallback, fallbacklength+1);
data/libxdg-basedir-1.2.0/src/basedir.c:249: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).
		if (!(item = (char*)malloc(strlen(env)+1))) return NULL;
data/libxdg-basedir-1.2.0/src/basedir.c:266: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).
			if (!(item = (char*)malloc(strlen(defaults[i])+1))) { xdgFreeStringList(itemlist); return NULL; }
data/libxdg-basedir-1.2.0/src/basedir.c:329:41:  [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 (!(value = (char*)malloc((homelen = strlen(homeenv))+extralen))) return FALSE;
data/libxdg-basedir-1.2.0/src/basedir.c:455:34:  [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 (!(fullPath = (char*)malloc(strlen(*item)+strlen(relativePath)+2)))
data/libxdg-basedir-1.2.0/src/basedir.c:455: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).
		if (!(fullPath = (char*)malloc(strlen(*item)+strlen(relativePath)+2)))
data/libxdg-basedir-1.2.0/src/basedir.c:461:16:  [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 (fullPath[strlen(fullPath)-1] != DIR_SEPARATOR_CHAR)
data/libxdg-basedir-1.2.0/src/basedir.c:467:58:  [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 (!(tmpString = (char*)realloc(returnString, strLen+strlen(fullPath)+2)))
data/libxdg-basedir-1.2.0/src/basedir.c:475:20:  [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 = strLen+strlen(fullPath)+1;
data/libxdg-basedir-1.2.0/src/basedir.c:485:4:  [1] (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). Risk is low because the source is a constant character.
			strcpy(returnString, "\0");
data/libxdg-basedir-1.2.0/src/basedir.c:504:34:  [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 (!(fullPath = (char*)malloc(strlen(*item)+strlen(relativePath)+2)))
data/libxdg-basedir-1.2.0/src/basedir.c:504: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).
		if (!(fullPath = (char*)malloc(strlen(*item)+strlen(relativePath)+2)))
data/libxdg-basedir-1.2.0/src/basedir.c:507:16:  [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 (fullPath[strlen(fullPath)-1] != DIR_SEPARATOR_CHAR)
data/libxdg-basedir-1.2.0/src/basedir.c:520:15:  [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 length = strlen(path);
data/libxdg-basedir-1.2.0/src/basedir.c:577:44:  [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 (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength+1))) return NULL;
data/libxdg-basedir-1.2.0/tests/testfind.c:37:10:  [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).
		ptr += strlen(ptr)+1;

ANALYSIS SUMMARY:

Hits = 36
Lines analyzed = 1139 in approximately 0.06 seconds (18317 lines/second)
Physical Source Lines of Code (SLOC) = 695
Hits@level = [0]  17 [1]  15 [2]   9 [3]   2 [4]  10 [5]   0
Hits@level+ = [0+]  53 [1+]  36 [2+]  21 [3+]  12 [4+]  10 [5+]   0
Hits/KSLOC@level+ = [0+] 76.259 [1+] 51.7986 [2+] 30.2158 [3+] 17.2662 [4+] 14.3885 [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.