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/ghex-3.18.4/src/accessiblegtkhex.c Examining data/ghex-3.18.4/src/accessiblegtkhex.h Examining data/ghex-3.18.4/src/accessiblegtkhexfactory.c Examining data/ghex-3.18.4/src/accessiblegtkhexfactory.h Examining data/ghex-3.18.4/src/chartable.c Examining data/ghex-3.18.4/src/chartable.h Examining data/ghex-3.18.4/src/config.c Examining data/ghex-3.18.4/src/configuration.h Examining data/ghex-3.18.4/src/converter.c Examining data/ghex-3.18.4/src/converter.h Examining data/ghex-3.18.4/src/factory.c Examining data/ghex-3.18.4/src/factory.h Examining data/ghex-3.18.4/src/findreplace.c Examining data/ghex-3.18.4/src/findreplace.h Examining data/ghex-3.18.4/src/ghex-window.c Examining data/ghex-3.18.4/src/ghex-window.h Examining data/ghex-3.18.4/src/gtkhex-private.h Examining data/ghex-3.18.4/src/gtkhex.c Examining data/ghex-3.18.4/src/gtkhex.h Examining data/ghex-3.18.4/src/hex-dialog.c Examining data/ghex-3.18.4/src/hex-dialog.h Examining data/ghex-3.18.4/src/hex-document-ui.c Examining data/ghex-3.18.4/src/hex-document.c Examining data/ghex-3.18.4/src/hex-document.h Examining data/ghex-3.18.4/src/main.c Examining data/ghex-3.18.4/src/preferences.c Examining data/ghex-3.18.4/src/preferences.h Examining data/ghex-3.18.4/src/print.c Examining data/ghex-3.18.4/src/print.h Examining data/ghex-3.18.4/src/ui.c Examining data/ghex-3.18.4/src/ui.h FINAL RESULTS: data/ghex-3.18.4/src/ghex-window.c:1246:12: [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(filename, F_OK) == 0) { data/ghex-3.18.4/src/hex-document.c:1035:4: [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. access(doc->file_name, W_OK) == 0); data/ghex-3.18.4/src/ui.c:471:6: [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(check_path, F_OK) == 0) { data/ghex-3.18.4/src/ui.c:475: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(check_path, W_OK) != 0) { data/ghex-3.18.4/src/ui.c:501: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(html_path, W_OK) != 0) { data/ghex-3.18.4/src/chartable.c:91:53: [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). hex_document_set_byte(win->gh->document, (guchar)atoi(g_value_get_string(&value)), win->gh->cursor_pos, data/ghex-3.18.4/src/ghex-window.c:1268:24: [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((file = fopen(filename, "wb")) != NULL) { data/ghex-3.18.4/src/gtkhex.c:176: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 (str, "%c", (gchar)i); data/ghex-3.18.4/src/gtkhex.c:812:3: [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(offstr, "%08X", (gh->top_line + i)*gh->cpl + gh->starting_offset); data/ghex-3.18.4/src/hex-dialog.c:302: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 convbuffer[CONV_BUFSIZE]; data/ghex-3.18.4/src/hex-document.c:105: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(cd, change_data, sizeof(HexChangeData)); data/ghex-3.18.4/src/hex-document.c:108: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(cd->v_string, change_data->v_string, cd->rep_len); data/ghex-3.18.4/src/hex-document.c:655:13: [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((file = fopen(doc->file_name, "r")) == NULL) data/ghex-3.18.4/src/hex-document.c:704:13: [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((file = fopen(doc->file_name, "wb")) != NULL) { data/ghex-3.18.4/src/hex-document.c:767: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). file = fopen(page_name, "w"); data/ghex-3.18.4/src/hex-document.c:824:10: [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 = fopen(page_name, "w"); data/ghex-3.18.4/src/config.c:107: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). len = strlen (offset_fmt); data/ghex-3.18.4/src/converter.c:389:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, text, 4); data/ghex-3.18.4/src/converter.c:391:29: [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(val = 0, i = 0, len = strlen(buffer); i < len; i++) { data/ghex-3.18.4/src/converter.c:397:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, text, 32); data/ghex-3.18.4/src/converter.c:401:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, text, 12); data/ghex-3.18.4/src/converter.c:405:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, text, 10); data/ghex-3.18.4/src/converter.c:409:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, text, 8); data/ghex-3.18.4/src/findreplace.c:606: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(byte_str); data/ghex-3.18.4/src/ghex-window.c:792: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). len = strlen(status); data/ghex-3.18.4/src/ghex-window.c:920:14: [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); data/ghex-3.18.4/src/ghex-window.c:971:14: [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); data/ghex-3.18.4/src/gtkhex.c:1125: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). strlen(text), 0, text, TRUE); data/ghex-3.18.4/src/gtkhex.c:1126: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). gtk_hex_set_cursor(gh, gh->cursor_pos + strlen(text)); data/ghex-3.18.4/src/gtkhex.c:1222: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). strlen(text), 0, text, TRUE); data/ghex-3.18.4/src/gtkhex.c:1223: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). gtk_hex_set_cursor(gh, gh->cursor_pos + strlen(text)); data/ghex-3.18.4/src/gtkhex.c:1718: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). strlen(text), 0, text, TRUE); data/ghex-3.18.4/src/gtkhex.c:1719:43: [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_hex_set_cursor(gh, gh->cursor_pos + strlen(text)); data/ghex-3.18.4/src/hex-dialog.c:275: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). width_chars = strlen (dialog_prop_get_text (i, dialog, &val)); data/ghex-3.18.4/src/preferences.c:537: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(offset_fmt); ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 11758 in approximately 0.30 seconds (38598 lines/second) Physical Source Lines of Code (SLOC) = 8849 Hits@level = [0] 96 [1] 19 [2] 11 [3] 0 [4] 5 [5] 0 Hits@level+ = [0+] 131 [1+] 35 [2+] 16 [3+] 5 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 14.8039 [1+] 3.95525 [2+] 1.80811 [3+] 0.565036 [4+] 0.565036 [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.