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/libdebug-0.5.3/include/debug/hex.h Examining data/libdebug-0.5.3/include/debug/log.h Examining data/libdebug-0.5.3/include/debug/memory.h Examining data/libdebug-0.5.3/src/hex.c Examining data/libdebug-0.5.3/src/log.c Examining data/libdebug-0.5.3/src/memory.c Examining data/libdebug-0.5.3/src/syslog.c Examining data/libdebug-0.5.3/tests/test_hex.c Examining data/libdebug-0.5.3/tests/test_log.c Examining data/libdebug-0.5.3/tests/test_memory.c FINAL RESULTS: data/libdebug-0.5.3/include/debug/log.h:119:27: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf,5,6))); data/libdebug-0.5.3/src/hex.c:53:18: [4] (format) vsnprintf: 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. const int res = vsnprintf(buf, len, fmt, v); data/libdebug-0.5.3/src/log.c:132:7: [4] (format) vsnprintf: 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. n = vsnprintf (buf,size,fmt,ap_copy); data/libdebug-0.5.3/src/memory.c:44:20: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define log_printf fprintf data/libdebug-0.5.3/src/memory.c:51:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr,fmt,##args); \ data/libdebug-0.5.3/tests/test_log.c:57:3: [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,ap); data/libdebug-0.5.3/src/hex.c:94: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 buf[BUF_SIZE]; data/libdebug-0.5.3/src/log.c:84: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 buf[256]; /* buffer used for saving "Message repeated..." messages */ data/libdebug-0.5.3/src/log.c:197: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 *buf[5]; data/libdebug-0.5.3/src/log.c:369:3: [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 b[35]; data/libdebug-0.5.3/src/log.c:595:25: [2] (misc) open: 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 ((log_private.fd = open (logfile,O_CREAT | O_APPEND | O_WRONLY,S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) data/libdebug-0.5.3/src/log.c:657:25: [2] (misc) open: 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 ((log_private.fd = open (log_private.filename,O_CREAT | O_APPEND | O_WRONLY,S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) data/libdebug-0.5.3/src/log.c:710: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 s[2] = { c, '\0' }; data/libdebug-0.5.3/src/memory.c:133: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 str[100]; data/libdebug-0.5.3/src/memory.c:189: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 str[100]; data/libdebug-0.5.3/src/memory.c:231: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 (ptr2,ptr,old_size); data/libdebug-0.5.3/src/memory.c:244: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 str[100]; data/libdebug-0.5.3/tests/test_hex.c:110:19: [2] (misc) open: 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). else if ((fd = open (argv[1],O_RDONLY)) < 0) data/libdebug-0.5.3/src/log.c:240: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). len += strlen (buf[i]); data/libdebug-0.5.3/src/log.c:273: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). size_t len = strlen (str) + 1; data/libdebug-0.5.3/src/log.c:278: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). size_t priv_len = strlen(priv->str); data/libdebug-0.5.3/src/log.c:317: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). ssize_t n,len = strlen (str); data/libdebug-0.5.3/src/log.c:548: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). size_t sz = strlen(str) + 1; data/libdebug-0.5.3/src/log.c:591: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). size_t sz = strlen(logfile) + 1; data/libdebug-0.5.3/src/log.c:738: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). size_t sz = strlen(str) + 1; data/libdebug-0.5.3/src/syslog.c:39: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). size_t sz = strlen(str) + 1; data/libdebug-0.5.3/tests/test_hex.c:57:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((result = read (fd,buf + *length,size - *length)) > 0) ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 1945 in approximately 0.08 seconds (23430 lines/second) Physical Source Lines of Code (SLOC) = 1194 Hits@level = [0] 15 [1] 9 [2] 12 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 42 [1+] 27 [2+] 18 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 35.1759 [1+] 22.6131 [2+] 15.0754 [3+] 5.02513 [4+] 5.02513 [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.