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/gtk-theme-switch-2.1.0/main.c

FINAL RESULTS:

data/gtk-theme-switch-2.1.0/main.c:147:8:  [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(gtkrc_path, R_OK) == -1) continue;
data/gtk-theme-switch-2.1.0/main.c:176:8:  [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(gtkrc_path, R_OK) == -1) continue;
data/gtk-theme-switch-2.1.0/main.c:605:9:  [4] (shell) popen:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
	pipe = popen(command,"r");
data/gtk-theme-switch-2.1.0/main.c:854:11:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
	result = system(command);
data/gtk-theme-switch-2.1.0/main.c:891: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 (basename, interestingpath);
data/gtk-theme-switch-2.1.0/main.c:977: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.
	homedir = getenv("HOME");
data/gtk-theme-switch-2.1.0/main.c:98:16:  [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 *gtkrc = fopen(path_to_gtkrc, "r");
data/gtk-theme-switch-2.1.0/main.c:99:2:  [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 tempbuf[16384], *commentsearch;
data/gtk-theme-switch-2.1.0/main.c:301:16:  [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 *gtkrc = fopen(path, "w");
data/gtk-theme-switch-2.1.0/main.c:328:16:  [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 (!(gtkrc = fopen(path_to_gtkrc, "r")))
data/gtk-theme-switch-2.1.0/main.c:331:23:  [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 *gtkrc_backup = fopen(g_strdup_printf("%s/.gtkrc-2.0.bak", homedir),"w");
data/gtk-theme-switch-2.1.0/main.c:619:52:  [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).
		     	kids = g_slist_append(kids,GINT_TO_POINTER(atoi(line+4)));
data/gtk-theme-switch-2.1.0/main.c:622:52:  [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).
		     	kids = g_slist_remove(kids,GINT_TO_POINTER(atoi(line+4)));
data/gtk-theme-switch-2.1.0/main.c:919: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 (fullpath, homedir, homedir_len);
data/gtk-theme-switch-2.1.0/main.c:920: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 (fullpath+homedir_len, "/.themes/", 9);
data/gtk-theme-switch-2.1.0/main.c:922: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 (fullpath+homedir_len+9, path, path_len+1);
data/gtk-theme-switch-2.1.0/main.c:929: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 (fullpath, gtk_rc_theme_dir, gtk_rc_theme_dir_len);
data/gtk-theme-switch-2.1.0/main.c:931: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 (fullpath+gtk_rc_theme_dir_len, path, path_len+1);
data/gtk-theme-switch-2.1.0/main.c:333:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while((c = fgetc(gtkrc)) != EOF){
data/gtk-theme-switch-2.1.0/main.c:390:9:  [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).
	for (i=strlen(rc_file); i != 0; --i)
data/gtk-theme-switch-2.1.0/main.c:396:9:  [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).
	for (i=strlen(rc_file) /*different*/; i != 0; --i)
data/gtk-theme-switch-2.1.0/main.c:617:13:  [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).
	     	line[strlen(line)-1] = '\0';	       
data/gtk-theme-switch-2.1.0/main.c:629:3:  [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(50000);
data/gtk-theme-switch-2.1.0/main.c:732: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).
     	gtk_text_buffer_set_text(buff,bb, strlen(bb));
data/gtk-theme-switch-2.1.0/main.c:816: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).
	out = g_new(gchar, strlen(arg) * 2 + 1);
data/gtk-theme-switch-2.1.0/main.c:889:27:  [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).
		interestingpath = &path[strlen(path)-1];
data/gtk-theme-switch-2.1.0/main.c:911:18:  [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).
	gint path_len = strlen(path), homedir_len = strlen(homedir);
data/gtk-theme-switch-2.1.0/main.c:911:46:  [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).
	gint path_len = strlen(path), homedir_len = strlen(homedir);
data/gtk-theme-switch-2.1.0/main.c:913: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).
	gint gtk_rc_theme_dir_len = strlen(gtk_rc_theme_dir);

ANALYSIS SUMMARY:

Hits = 29
Lines analyzed = 1101 in approximately 0.07 seconds (15997 lines/second)
Physical Source Lines of Code (SLOC) = 828
Hits@level = [0]   8 [1]  11 [2]  12 [3]   1 [4]   5 [5]   0
Hits@level+ = [0+]  37 [1+]  29 [2+]  18 [3+]   6 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 44.686 [1+] 35.0242 [2+] 21.7391 [3+] 7.24638 [4+] 6.03865 [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.