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/galculator-2.1.4/src/calc_basic.c
Examining data/galculator-2.1.4/src/calc_basic.h
Examining data/galculator-2.1.4/src/callbacks.c
Examining data/galculator-2.1.4/src/callbacks.h
Examining data/galculator-2.1.4/src/config_file.c
Examining data/galculator-2.1.4/src/config_file.h
Examining data/galculator-2.1.4/src/display.c
Examining data/galculator-2.1.4/src/display.h
Examining data/galculator-2.1.4/src/flex_parser.h
Examining data/galculator-2.1.4/src/g_real.h
Examining data/galculator-2.1.4/src/galculator.h
Examining data/galculator-2.1.4/src/general_functions.c
Examining data/galculator-2.1.4/src/general_functions.h
Examining data/galculator-2.1.4/src/main.c
Examining data/galculator-2.1.4/src/math_functions.c
Examining data/galculator-2.1.4/src/math_functions.h
Examining data/galculator-2.1.4/src/ui.c
Examining data/galculator-2.1.4/src/ui.h

FINAL RESULTS:

data/galculator-2.1.4/src/calc_basic.c:695:8:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	len = snprintf(s, 128*sizeof(char), formatString, x); 
data/galculator-2.1.4/src/calc_basic.c:724:8:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	len = snprintf(s, 128*sizeof(char), formatString, prec, x); 
data/galculator-2.1.4/src/general_functions.c:59:2:  [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.
	vfprintf (stderr, format_string, ap);
data/galculator-2.1.4/src/main.c:185:24:  [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.
    config_file_name = getenv("GALCULATOR_CONFIG");
data/galculator-2.1.4/src/main.c:201:58:  [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 *config_file_name_old = g_strdup_printf("%s/%s", getenv ("HOME"), CONFIG_FILE_NAME_OLD);
data/galculator-2.1.4/src/main.c:274: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("GALCULATOR_CONFIG")) {
data/galculator-2.1.4/src/callbacks.c:146: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 text[2];
data/galculator-2.1.4/src/callbacks.c:1229: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 (&user_function[counter], &user_function[counter+1], sizeof(s_user_function));
data/galculator-2.1.4/src/callbacks.c:1333: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 (&constant[counter], &constant[counter+1], sizeof(s_constant));
data/galculator-2.1.4/src/config_file.c:98: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 *prefs_list_old_entries[3] = {"show_status_bar", "remembered_value", NULL};
data/galculator-2.1.4/src/config_file.c:366: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		line[MAX_FILE_LINE_LENGTH], *key, *value;
data/galculator-2.1.4/src/config_file.c:371: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).
	this_file = fopen (filename, "r");
data/galculator-2.1.4/src/config_file.c:454: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).
	this_file = fopen (filename, "w+");
data/galculator-2.1.4/src/display.c:43: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	*number_mod_labels[5] = {" DEC ", " HEX ", " OCT ", " BIN ", NULL}, 
data/galculator-2.1.4/src/galculator.h:176: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		*display_names[4];
data/galculator-2.1.4/src/general_functions.c:366: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 *valid_numbers[4]={"1234567890", "1234567890abcdef", "12345670", "01"};
data/galculator-2.1.4/src/general_functions.c:537: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 	*stack[3];
data/galculator-2.1.4/src/ui.c:37: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		dec_point[2];
data/galculator-2.1.4/src/ui.c:139: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 (func, function_map[counter].func, sizeof (function_map[counter].func));
data/galculator-2.1.4/src/ui.h:27: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.
extern char		dec_point[2];
data/galculator-2.1.4/src/callbacks.c:1187: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).
    if ((strlen(name) == 0) || (strlen(value) == 0) || (strlen(desc) == 0)) {
data/galculator-2.1.4/src/callbacks.c:1187:33:  [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 ((strlen(name) == 0) || (strlen(value) == 0) || (strlen(desc) == 0)) {
data/galculator-2.1.4/src/callbacks.c:1187:57:  [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 ((strlen(name) == 0) || (strlen(value) == 0) || (strlen(desc) == 0)) {
data/galculator-2.1.4/src/callbacks.c:1292: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).
    if ((strlen(name) == 0) || (strlen(value) == 0) || (strlen(desc) == 0)) {
data/galculator-2.1.4/src/callbacks.c:1292:33:  [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 ((strlen(name) == 0) || (strlen(value) == 0) || (strlen(desc) == 0)) {
data/galculator-2.1.4/src/callbacks.c:1292:57:  [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 ((strlen(name) == 0) || (strlen(value) == 0) || (strlen(desc) == 0)) {
data/galculator-2.1.4/src/callbacks.c:1712:78:  [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_editable_insert_text (GTK_EDITABLE (entry), stripped_string, strlen(stripped_string), &position);
data/galculator-2.1.4/src/config_file.c:245:37:  [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[0] == '\"') && (value[strlen(value)-1] == '\"'))
data/galculator-2.1.4/src/config_file.c:248: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).
				value[strlen(value)-1]='\0';
data/galculator-2.1.4/src/config_file.c:279:8:  [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).
	len = strlen(line);
data/galculator-2.1.4/src/config_file.c:312: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).
	if (strlen(value) == 0) return;
data/galculator-2.1.4/src/config_file.c:347:7:  [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 ((strlen(variable) == 0) || (strlen(expression) == 0)) return;
data/galculator-2.1.4/src/config_file.c:347: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 ((strlen(variable) == 0) || (strlen(expression) == 0)) return;
data/galculator-2.1.4/src/display.c:96:7:  [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 (strlen (selected_text) <= 2) return FALSE;
data/galculator-2.1.4/src/display.c:539: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).
		length+=strlen(text[counter]);
data/galculator-2.1.4/src/display.c:687:28:  [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).
		display_result_counter = strlen (string);
data/galculator-2.1.4/src/display.c:725:7:  [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 (strlen (display_string) == 0)
data/galculator-2.1.4/src/display.c:770: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).
    gboolean toggleSign = current_status.calc_entry_start_new && (strlen(string) > 0) && (*string == '-');
data/galculator-2.1.4/src/display.c:772:33:  [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 (counter = 0; counter < strlen(string); counter++) {
data/galculator-2.1.4/src/display.c:777: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 (strlen(dline) < 3) break;
data/galculator-2.1.4/src/display.c:778:32:  [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 (strncmp(&dline[strlen(dline)-2], "e+", 2) == 0) display_result_toggle_sign(NULL);
data/galculator-2.1.4/src/display.c:872: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).
			memmove(result_field, result_field + sizeof(char), strlen(result_field));
data/galculator-2.1.4/src/display.c:885:7:  [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 (strlen(e_pointer) > 1) 
data/galculator-2.1.4/src/display.c:908:7:  [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 (strlen(current_entry) == 1) current_entry[0] = '0';
data/galculator-2.1.4/src/display.c:909: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).
        else if ((strlen(current_entry) == 2) && (*current_entry == '-')) strcpy(current_entry, "0");
data/galculator-2.1.4/src/display.c:909:75:  [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.
        else if ((strlen(current_entry) == 2) && (*current_entry == '-')) strcpy(current_entry, "0");
data/galculator-2.1.4/src/display.c:910: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).
		else if (current_entry[strlen(current_entry) - 2] == 'e') current_entry[strlen(current_entry) - 2] = '\0';
data/galculator-2.1.4/src/display.c:910:75:  [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 (current_entry[strlen(current_entry) - 2] == 'e') current_entry[strlen(current_entry) - 2] = '\0';
data/galculator-2.1.4/src/display.c:911: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).
		else current_entry[strlen(current_entry) - 1] = '\0';
data/galculator-2.1.4/src/general_functions.c:133: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).
	for (counter = strlen (lower_bin_string) - 1; counter >= 0; counter--) {
data/galculator-2.1.4/src/general_functions.c:135:69:  [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).
			return_value += (lower_bin_string[counter] - '0') * G_POW (base, strlen (lower_bin_string) - 1 - counter);
data/galculator-2.1.4/src/general_functions.c:137:74:  [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).
			return_value += (lower_bin_string[counter] - 'a' + 10) * G_POW (base, strlen (lower_bin_string) - 1 - counter);
data/galculator-2.1.4/src/general_functions.c:210: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).
	length = strlen(string);
data/galculator-2.1.4/src/general_functions.c:419:8:  [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 (strlen(string_value0) + 1 < strlen(string_value1)) {
data/galculator-2.1.4/src/general_functions.c:419:36:  [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 (strlen(string_value0) + 1 < strlen(string_value1)) {
data/galculator-2.1.4/src/general_functions.c:615: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).
	new_string = (char *) g_malloc ((strlen(string) + (int_length-1)/block_length +
data/galculator-2.1.4/src/general_functions.c:820: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).
	if (strlen(sep) > 0) {
data/galculator-2.1.4/src/general_functions.c:917: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).
	if (strlen (locale_settings->decimal_point) != 1) {
data/galculator-2.1.4/src/ui.c:1173:3:  [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(gtk_entry_get_text((GtkEntry *) formula_entry)) - 1, -1);

ANALYSIS SUMMARY:

Hits = 59
Lines analyzed = 8044 in approximately 0.26 seconds (31453 lines/second)
Physical Source Lines of Code (SLOC) = 5633
Hits@level = [0]  49 [1]  39 [2]  14 [3]   3 [4]   3 [5]   0
Hits@level+ = [0+] 108 [1+]  59 [2+]  20 [3+]   6 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 19.1727 [1+] 10.474 [2+] 3.55051 [3+] 1.06515 [4+] 0.532576 [5+]   0
Dot directories skipped = 2 (--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.