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/postgresql-mysql-fdw-2.5.5/connection.c Examining data/postgresql-mysql-fdw-2.5.5/deparse.c Examining data/postgresql-mysql-fdw-2.5.5/mysql_fdw.c Examining data/postgresql-mysql-fdw-2.5.5/mysql_fdw.h Examining data/postgresql-mysql-fdw-2.5.5/mysql_query.c Examining data/postgresql-mysql-fdw-2.5.5/mysql_query.h Examining data/postgresql-mysql-fdw-2.5.5/option.c FINAL RESULTS: data/postgresql-mysql-fdw-2.5.5/mysql_fdw.c:460: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 timeout[255]; data/postgresql-mysql-fdw-2.5.5/mysql_fdw.c:512:3: [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(timeout, "SET wait_timeout = %d", wait_timeout); data/postgresql-mysql-fdw-2.5.5/mysql_fdw.c:519:3: [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(timeout, "SET interactive_timeout = %d", interactive_timeout); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:68: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 str[MAXDATELEN]; data/postgresql-mysql-fdw-2.5.5/mysql_query.c:106:4: [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(str, "%d", dec_bin(*((int *) column->value))); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:209: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(bufptr, (char *) &dat, sizeof(int16)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:219: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(bufptr, (char *) &dat, sizeof(int32)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:229: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(bufptr, (char *) &dat, sizeof(int64)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:239: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(bufptr, (char *) &dat, sizeof(float4)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:249: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(bufptr, (char *) &dat, sizeof(float8)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:261: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(bufptr, (char *) &dat, sizeof(float8)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:271: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(bufptr, (char *) &dat, sizeof(int32)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:359:19: [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). dat = bin_dec(atoi(outputString)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:360: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(bufptr, (char *) &dat, sizeof(int32)); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:383: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(bufptr, (char *) dat, len); data/postgresql-mysql-fdw-2.5.5/option.c:185: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). opt->svr_port = atoi(defGetString(def)); data/postgresql-mysql-fdw-2.5.5/deparse.c:178: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). char *result = palloc(strlen(str) * 2 + 3); data/postgresql-mysql-fdw-2.5.5/deparse.c:459:53: [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 ((ch == '{' && i == 0) || (ch == '}' && (i == (strlen(val) - 1))) || data/postgresql-mysql-fdw-2.5.5/deparse.c:706:9: [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. if (equal(node, (Node *) lfirst(lc))) data/postgresql-mysql-fdw-2.5.5/deparse.c:761:46: [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 (strspn(extval, "0123456789+-eE.") == strlen(extval)) data/postgresql-mysql-fdw-2.5.5/deparse.c:825:8: [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. if (equal(node, (Node *) lfirst(lc))) data/postgresql-mysql-fdw-2.5.5/mysql_fdw.c:535: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). strlen(festate->query)) != 0) data/postgresql-mysql-fdw-2.5.5/mysql_fdw.c:1383: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). strlen(fmstate->query)) != 0) data/postgresql-mysql-fdw-2.5.5/mysql_query.c:290:35: [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). binds[attnum].buffer_length = strlen(outputString); data/postgresql-mysql-fdw-2.5.5/mysql_query.c:303:35: [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). binds[attnum].buffer_length = strlen(outputString); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 5193 in approximately 0.16 seconds (33374 lines/second) Physical Source Lines of Code (SLOC) = 3477 Hits@level = [0] 0 [1] 9 [2] 16 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 25 [1+] 25 [2+] 16 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 7.19011 [1+] 7.19011 [2+] 4.60167 [3+] 0 [4+] 0 [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.