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/ruby-pygments.rb-1.2.1/test/test_data.c FINAL RESULTS: data/ruby-pygments.rb-1.2.1/test/test_data.c:298:5: [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. vsnprintf(msg, sizeof(msg), fmt, ap); data/ruby-pygments.rb-1.2.1/test/test_data.c:2448:5: [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. snprintf(buf,1024*16,ascii_logo, data/ruby-pygments.rb-1.2.1/test/test_data.c:2498:5: [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(time(NULL)^getpid()); data/ruby-pygments.rb-1.2.1/test/test_data.c:261: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 buf[64]; data/ruby-pygments.rb-1.2.1/test/test_data.c:267:46: [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). fp = (server.logfile == NULL) ? stdout : fopen(server.logfile,"a"); data/ruby-pygments.rb-1.2.1/test/test_data.c:293: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 msg[REDIS_MAX_LOGMSG_LEN]; data/ruby-pygments.rb-1.2.1/test/test_data.c:312: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 buf[64]; data/ruby-pygments.rb-1.2.1/test/test_data.c:317:9: [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). open(server.logfile, O_APPEND|O_CREAT|O_WRONLY, 0644) : data/ruby-pygments.rb-1.2.1/test/test_data.c:471:13: [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[32]; data/ruby-pygments.rb-1.2.1/test/test_data.c:1337: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). server.aof_fd = open(server.aof_filename, data/ruby-pygments.rb-1.2.1/test/test_data.c:1756: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 bufa[REDIS_AUTHPASS_MAX_LEN], bufb[REDIS_AUTHPASS_MAX_LEN]; data/ruby-pygments.rb-1.2.1/test/test_data.c:1775:5: [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(bufa,a,alen); data/ruby-pygments.rb-1.2.1/test/test_data.c:1776:5: [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(bufb,b,blen); data/ruby-pygments.rb-1.2.1/test/test_data.c:1826:9: [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(s,"%lluB",n); data/ruby-pygments.rb-1.2.1/test/test_data.c:1830:9: [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(s,"%.2fK",d); data/ruby-pygments.rb-1.2.1/test/test_data.c:1833:9: [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(s,"%.2fM",d); data/ruby-pygments.rb-1.2.1/test/test_data.c:1836:9: [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(s,"%.2fG",d); data/ruby-pygments.rb-1.2.1/test/test_data.c:1917:9: [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 hmem[64]; data/ruby-pygments.rb-1.2.1/test/test_data.c:1918:9: [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 peak_hmem[64]; data/ruby-pygments.rb-1.2.1/test/test_data.c:2105:17: [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 ip[32]; data/ruby-pygments.rb-1.2.1/test/test_data.c:2373: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 *fp = fopen("/proc/sys/vm/overcommit_memory","r"); data/ruby-pygments.rb-1.2.1/test/test_data.c:2374: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 buf[64]; data/ruby-pygments.rb-1.2.1/test/test_data.c:2383:12: [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). return atoi(buf); data/ruby-pygments.rb-1.2.1/test/test_data.c:2395: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 *fp = fopen(server.pidfile,"w"); data/ruby-pygments.rb-1.2.1/test/test_data.c:2411:15: [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 ((fd = open("/dev/null", O_RDWR, 0)) != -1) { data/ruby-pygments.rb-1.2.1/test/test_data.c:2423:9: [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). atoi(redisGitDirty()) > 0, data/ruby-pygments.rb-1.2.1/test/test_data.c:2515:25: [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). memtest(atoi(argv[2]),50); data/ruby-pygments.rb-1.2.1/test/test_data.c:322: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). if (write(fd,buf,strlen(buf)) == -1) goto err; data/ruby-pygments.rb-1.2.1/test/test_data.c:325: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). if (write(fd,buf,strlen(buf)) == -1) goto err; data/ruby-pygments.rb-1.2.1/test/test_data.c:327: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). if (write(fd,msg,strlen(msg)) == -1) goto err; data/ruby-pygments.rb-1.2.1/test/test_data.c:1761: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). int alen = strlen(a); data/ruby-pygments.rb-1.2.1/test/test_data.c:1762: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). int blen = strlen(b); data/ruby-pygments.rb-1.2.1/test/test_data.c:2539:54: [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). options = sdscatrepr(options,argv[j],strlen(argv[j])); ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 2581 in approximately 0.10 seconds (24838 lines/second) Physical Source Lines of Code (SLOC) = 1869 Hits@level = [0] 19 [1] 6 [2] 24 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 52 [1+] 33 [2+] 27 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 27.8224 [1+] 17.6565 [2+] 14.4462 [3+] 1.60514 [4+] 1.07009 [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.