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/giblib-1.2.4/giblib/gib_debug.h Examining data/giblib-1.2.4/giblib/giblib.h Examining data/giblib-1.2.4/giblib/gib_list.c Examining data/giblib-1.2.4/giblib/gib_list.h Examining data/giblib-1.2.4/giblib/gib_hash.c Examining data/giblib-1.2.4/giblib/gib_hash.h Examining data/giblib-1.2.4/giblib/gib_btree.c Examining data/giblib-1.2.4/giblib/gib_btree.h Examining data/giblib-1.2.4/giblib/gib_style.c Examining data/giblib-1.2.4/giblib/gib_style.h Examining data/giblib-1.2.4/giblib/gib_imlib.c Examining data/giblib-1.2.4/giblib/gib_imlib.h Examining data/giblib-1.2.4/giblib/gib_stack.c Examining data/giblib-1.2.4/giblib/gib_stack.h Examining data/giblib-1.2.4/giblib/gib_utils.c Examining data/giblib-1.2.4/giblib/gib_utils.h Examining data/giblib-1.2.4/giblib/gib_queue.c Examining data/giblib-1.2.4/giblib/gib_queue.h FINAL RESULTS: data/giblib-1.2.4/giblib/gib_list.c:609: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(string, s); data/giblib-1.2.4/giblib/gib_list.c:614:10: [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(string, separator); data/giblib-1.2.4/giblib/gib_list.c:615:10: [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(string, s); data/giblib-1.2.4/giblib/gib_utils.c:39:4: [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, fmt, args); data/giblib-1.2.4/giblib/gib_utils.c:58:4: [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, fmt, args); data/giblib-1.2.4/giblib/gib_utils.c:76: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(t, s); data/giblib-1.2.4/giblib/gib_list.c:357:4: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(getpid() * time(NULL) % ((unsigned int) -1)); data/giblib-1.2.4/giblib/gib_imlib.c:636:15: [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). rr = atoi(ll->data); data/giblib-1.2.4/giblib/gib_imlib.c:637:15: [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). gg = atoi(ll->next->data); data/giblib-1.2.4/giblib/gib_imlib.c:638:15: [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). bb = atoi(ll->next->next->data); data/giblib-1.2.4/giblib/gib_imlib.c:643:15: [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). rr = atoi(ll->data); data/giblib-1.2.4/giblib/gib_imlib.c:644:15: [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). gg = atoi(ll->next->data); data/giblib-1.2.4/giblib/gib_imlib.c:645:15: [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). bb = atoi(ll->next->next->data); data/giblib-1.2.4/giblib/gib_imlib.c:646:15: [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). aa = atoi(ll->next->next->next->data); data/giblib-1.2.4/giblib/gib_style.c:109: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(*dest, data, sizeof(gib_style_bit)); data/giblib-1.2.4/giblib/gib_style.c:124: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). stylefile = fopen(file, "w"); data/giblib-1.2.4/giblib/gib_style.c:145:4: [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 current[4096]; data/giblib-1.2.4/giblib/gib_style.c:149: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). stylefile = fopen(file, "r"); data/giblib-1.2.4/giblib/gib_style.c:184:27: [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). x_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:187:27: [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). y_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:194:27: [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). x_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:197:27: [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). y_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:200:23: [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). a = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:207:27: [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). x_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:210:27: [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). y_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:216:20: [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). r = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:219:20: [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). g = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:222:20: [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). b = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:225:20: [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). a = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:228:24: [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). x_off = atoi(s); data/giblib-1.2.4/giblib/gib_style.c:231:24: [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). y_off = atoi(s); data/giblib-1.2.4/giblib/gib_utils.c:114:11: [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 buf[1024]; data/giblib-1.2.4/giblib/gib_imlib.c:601: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). len = strlen(col); data/giblib-1.2.4/giblib/gib_list.c:546: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). unsigned int delimiter_len = strlen(delimiter); data/giblib-1.2.4/giblib/gib_list.c:556:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(new_string, string, len); data/giblib-1.2.4/giblib/gib_list.c:588: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). separator_len = strlen(separator); data/giblib-1.2.4/giblib/gib_list.c:594: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). len = strlen(s); data/giblib-1.2.4/giblib/gib_list.c:599: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). len += separator_len + strlen(s); data/giblib-1.2.4/giblib/gib_style.c:165: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). l = strlen(current) - 1; data/giblib-1.2.4/giblib/gib_style.c:177: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(s) == 2) data/giblib-1.2.4/giblib/gib_utils.c:42: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 (fmt[0] != '\0' && fmt[strlen(fmt) - 1] == ':') data/giblib-1.2.4/giblib/gib_utils.c:61: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 (fmt[0] != '\0' && fmt[strlen(fmt) - 1] == ':') data/giblib-1.2.4/giblib/gib_utils.c:73: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). t = (char *) malloc(strlen(s) + 1); ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 2951 in approximately 0.11 seconds (27785 lines/second) Physical Source Lines of Code (SLOC) = 2121 Hits@level = [0] 10 [1] 11 [2] 25 [3] 1 [4] 6 [5] 0 Hits@level+ = [0+] 53 [1+] 43 [2+] 32 [3+] 7 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 24.9882 [1+] 20.2735 [2+] 15.0872 [3+] 3.30033 [4+] 2.82885 [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.