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/bibtexconv-0.8.20/src/scanner.cc Examining data/bibtexconv-0.8.20/src/unification.cc Examining data/bibtexconv-0.8.20/src/grammar.cc Examining data/bibtexconv-0.8.20/src/bibtexconv.cc Examining data/bibtexconv-0.8.20/src/grammar.h Examining data/bibtexconv-0.8.20/src/node.h Examining data/bibtexconv-0.8.20/src/stringhandling.h Examining data/bibtexconv-0.8.20/src/node.cc Examining data/bibtexconv-0.8.20/src/publicationset.cc Examining data/bibtexconv-0.8.20/src/unification.h Examining data/bibtexconv-0.8.20/src/publicationset.h Examining data/bibtexconv-0.8.20/src/stringhandling.cc FINAL RESULTS: data/bibtexconv-0.8.20/src/bibtexconv.cc:184:34: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(system(command.c_str()) == 0) { data/bibtexconv-0.8.20/src/grammar.cc:707:21: [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 YYFPRINTF fprintf data/bibtexconv-0.8.20/src/stringhandling.cc:293:4: [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(buffer, sizeof(buffer), fmt, va); data/bibtexconv-0.8.20/src/bibtexconv.cc:87:35: [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* downloadFH = fopen(downloadFileName.c_str(), "rb"); data/bibtexconv-0.8.20/src/bibtexconv.cc:104:10: [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 downloadFileName[256]; data/bibtexconv-0.8.20/src/bibtexconv.cc:105:10: [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 mimeFileName[256]; data/bibtexconv-0.8.20/src/bibtexconv.cc:114:15: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). if( (mkstemp((char*)&downloadFileName) > 0) && data/bibtexconv-0.8.20/src/bibtexconv.cc:115:15: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). (mkstemp((char*)&mimeFileName) > 0) ) { data/bibtexconv-0.8.20/src/bibtexconv.cc:116:32: [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* downloadFH = fopen(downloadFileName, "w+b"); data/bibtexconv-0.8.20/src/bibtexconv.cc:118:33: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE* headerFH = tmpfile(); data/bibtexconv-0.8.20/src/bibtexconv.cc:140:28: [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 header[8192]; data/bibtexconv-0.8.20/src/bibtexconv.cc:166:37: [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. unsigned char md5[MD5_DIGEST_LENGTH]; data/bibtexconv-0.8.20/src/bibtexconv.cc:172:31: [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 input[16384]; data/bibtexconv-0.8.20/src/bibtexconv.cc:185:49: [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* mimeFH = fopen(mimeFileName, "r"); data/bibtexconv-0.8.20/src/bibtexconv.cc:187:37: [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 input[1024]; data/bibtexconv-0.8.20/src/bibtexconv.cc:242:31: [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 checkTime[128]; data/bibtexconv-0.8.20/src/bibtexconv.cc:330:7: [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 input[65536]; data/bibtexconv-0.8.20/src/bibtexconv.cc:358:19: [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 number[16]; data/bibtexconv-0.8.20/src/bibtexconv.cc:495:34: [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* includeFH = fopen(includeFileName, "r"); data/bibtexconv-0.8.20/src/bibtexconv.cc:624:11: [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). yyin = fopen(argv[1], "r"); data/bibtexconv-0.8.20/src/grammar.cc:1003: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/bibtexconv-0.8.20/src/grammar.cc:1238: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 yymsgbuf[128]; data/bibtexconv-0.8.20/src/node.cc:375: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 keywordString[keywordLength + 1]; data/bibtexconv-0.8.20/src/publicationset.cc:184:12: [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). fh = fopen(fileNamePrefix, "w"); data/bibtexconv-0.8.20/src/publicationset.cc:200: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 fileName[1024]; data/bibtexconv-0.8.20/src/publicationset.cc:202:18: [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). fh = fopen(fileName, "w"); data/bibtexconv-0.8.20/src/publicationset.cc:308:12: [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). fh = fopen(fileNamePrefix, "w"); data/bibtexconv-0.8.20/src/publicationset.cc:326: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 fileName[1024]; data/bibtexconv-0.8.20/src/publicationset.cc:328:18: [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). fh = fopen(fileName, "w"); data/bibtexconv-0.8.20/src/publicationset.cc:463:50: [2] (integer) atol: 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). octets = format(" octets=\"%u\"", atol(urlSize->value.c_str())); data/bibtexconv-0.8.20/src/publicationset.cc:539:28: [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[p + 1]; data/bibtexconv-0.8.20/src/publicationset.cc:541:31: [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((char*)&str, &namingTemplate[begin], p - begin); data/bibtexconv-0.8.20/src/publicationset.cc:559:28: [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[p + 3]; data/bibtexconv-0.8.20/src/publicationset.cc:562:31: [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((char*)&str[1], &namingTemplate[begin], p - begin); data/bibtexconv-0.8.20/src/publicationset.cc:713:19: [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 month[16]; data/bibtexconv-0.8.20/src/publicationset.cc:721:19: [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 day[16]; data/bibtexconv-0.8.20/src/stringhandling.cc:290: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 buffer[16384]; data/bibtexconv-0.8.20/src/unification.cc:347:20: [2] (integer) atol: 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). yearNumber = atol(year->value.c_str()); data/bibtexconv-0.8.20/src/unification.cc:416:21: [2] (integer) atol: 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). day->number = atol(day->value.c_str()); data/bibtexconv-0.8.20/src/unification.cc:483:7: [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 pagesString[64]; data/bibtexconv-0.8.20/src/bibtexconv.cc:333: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). const size_t length = strlen(input); data/bibtexconv-0.8.20/src/grammar.cc:887: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). # define yystrlen strlen data/bibtexconv-0.8.20/src/node.cc:374: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). const size_t keywordLength = strlen(keyword); data/bibtexconv-0.8.20/src/publicationset.cc:167:40: [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( (downloadDirectory != NULL) && (strlen(downloadDirectory) != 0) ) { data/bibtexconv-0.8.20/src/publicationset.cc:533:39: [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(namingTemplate); data/bibtexconv-0.8.20/src/scanner.cc:687:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/bibtexconv-0.8.20/src/scanner.cc:1803: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). return yy_scan_bytes(yystr,strlen(yystr) ); ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 7285 in approximately 0.20 seconds (36511 lines/second) Physical Source Lines of Code (SLOC) = 5255 Hits@level = [0] 89 [1] 7 [2] 37 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 136 [1+] 47 [2+] 40 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 25.8801 [1+] 8.94386 [2+] 7.6118 [3+] 0.570885 [4+] 0.570885 [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.