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/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp Examining data/quantlib-swig-1.20/R/src/QuantLib.cpp Examining data/quantlib-swig-1.20/Java/quantlib_wrap.cpp Examining data/quantlib-swig-1.20/Java/quantlib_wrap.h Examining data/quantlib-swig-1.20/CSharp/cpp/QuantlibWrapper.cpp Examining data/quantlib-swig-1.20/CSharp/cpp/QuantlibWrapper.h Examining data/quantlib-swig-1.20/CSharp/cpp/stdafx.h Examining data/quantlib-swig-1.20/CSharp/cpp/quantlib_wrap.cpp Examining data/quantlib-swig-1.20/CSharp/cpp/quantlib_wrap.h FINAL RESULTS: data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:706:3: [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(r,name); data/quantlib-swig-1.20/R/src/QuantLib.cpp:689:3: [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(r,name); data/quantlib-swig-1.20/R/src/QuantLib.cpp:794:3: [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(SWIG_lasterror_msg, sizeof(SWIG_lasterror_msg), format, arg); data/quantlib-swig-1.20/R/src/QuantLib.cpp:3389:15: [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). *cptr = strcpy(*cptr, cstr); data/quantlib-swig-1.20/CSharp/cpp/quantlib_wrap.cpp:54995:30: [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). result = (Real)(arg1)->open(); data/quantlib-swig-1.20/Java/quantlib_wrap.cpp:453: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 thread_name[64]; // MAX_TASK_COMM_LEN=16 is hard-coded in the Linux kernel and MacOS has MAXTHREADNAMESIZE=64. data/quantlib-swig-1.20/Java/quantlib_wrap.cpp:53060:30: [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). result = (Real)(arg1)->open(); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:657:16: [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 const char hex[17] = "0123456789abcdef"; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:822:9: [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(newstr, cstr, len+1); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:1825: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 result[SWIG_BUFFER_SIZE]; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:1836: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 result[SWIG_BUFFER_SIZE]; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:1972:7: [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(pack, ptr, size); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:1990: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(ptr, sobj->pack, size); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:2537: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 mesg[256]; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:5488:38: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:5530:45: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6161: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. char msg[1024]; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6162:11: [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(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6177: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 msg[1024]; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6178: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(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6517:2: [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[1024]; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6518:2: [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(msg, "in sequence element %d ", (int)_index); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:117724:30: [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). result = (Real)(arg1)->open(); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:618541:9: [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(gv->name, name, size); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:618622:15: [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(buff, methods[i].ml_doc, ldoc); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:618624:15: [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(buff, "swig_ptr: ", 10); data/quantlib-swig-1.20/R/src/QuantLib.cpp:640:16: [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 const char hex[17] = "0123456789abcdef"; data/quantlib-swig-1.20/R/src/QuantLib.cpp:789: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 SWIG_lasterror_msg[1024]; data/quantlib-swig-1.20/R/src/QuantLib.cpp:1123:7: [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(pack, ptr, sz); data/quantlib-swig-1.20/R/src/QuantLib.cpp:1141: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(ptr, sobj->pack, size); data/quantlib-swig-1.20/R/src/QuantLib.cpp:3382:43: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); data/quantlib-swig-1.20/R/src/QuantLib.cpp:81286:30: [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). result = (Real)(arg1)->open(); data/quantlib-swig-1.20/R/src/QuantLib.cpp:81421:48: [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). R_swig_IntervalPrice_makeSeries ( SEXP d, SEXP open, SEXP close, SEXP high, SEXP low, SEXP s_swig_copy) data/quantlib-swig-1.20/R/src/QuantLib.cpp:81451:24: [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). res2 = swig::asptr(open, &ptr); data/quantlib-swig-1.20/Java/quantlib_wrap.cpp:718:18: [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 msglen = strlen(srcmsg) + 1; data/quantlib-swig-1.20/Java/quantlib_wrap.cpp:720:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(target, srcmsg, msglen); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:421:25: [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 char* te = tb + strlen(tb); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:705:7: [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(name) + 1 > (bsz - (r - buff))) return 0; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:726:26: [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 lname = (name ? strlen(name) : 0); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:731:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(r,name,lname+1); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:4732:48: [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 SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:4867:18: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. virtual bool equal (const SwigPyIterator &/*x*/) const data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:4906:14: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return equal(x); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:5548: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 (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:6294:10: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. bool equal (const SwigPyIterator &iter) const data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:17104:62: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. result = (bool)((swig::SwigPyIterator const *)arg1)->equal((swig::SwigPyIterator const &)*arg2); data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:618538: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 size = strlen(name)+1; data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:618607: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). strlen(const_table[j].name)) == 0) { data/quantlib-swig-1.20/Python/QuantLib/quantlib_wrap.cpp:618618:27: [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 lptr = strlen(ty->name)+2*sizeof(void*)+2; data/quantlib-swig-1.20/R/src/QuantLib.cpp:404:25: [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 char* te = tb + strlen(tb); data/quantlib-swig-1.20/R/src/QuantLib.cpp:688:7: [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(name) + 1 > (bsz - (r - buff))) return 0; data/quantlib-swig-1.20/R/src/QuantLib.cpp:709:26: [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 lname = (name ? strlen(name) : 0); data/quantlib-swig-1.20/R/src/QuantLib.cpp:714:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(r,name,lname+1); data/quantlib-swig-1.20/R/src/QuantLib.cpp:3378: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). int len = strlen(cstr); data/quantlib-swig-1.20/R/src/QuantLib.cpp:3454:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)CHAR(c), carray, size); ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 1740318 in approximately 49.35 seconds (35262 lines/second) Physical Source Lines of Code (SLOC) = 1609780 Hits@level = [0] 30 [1] 21 [2] 30 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 85 [1+] 55 [2+] 34 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 0.0528022 [1+] 0.0341662 [2+] 0.0211209 [3+] 0.00248481 [4+] 0.00248481 [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.