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-rum-1.3.7/src/btree_rum.c Examining data/postgresql-rum-1.3.7/src/rum.h Examining data/postgresql-rum-1.3.7/src/rum_arr_utils.c Examining data/postgresql-rum-1.3.7/src/rum_ts_utils.c Examining data/postgresql-rum-1.3.7/src/rumbtree.c Examining data/postgresql-rum-1.3.7/src/rumbulk.c Examining data/postgresql-rum-1.3.7/src/rumdatapage.c Examining data/postgresql-rum-1.3.7/src/rumentrypage.c Examining data/postgresql-rum-1.3.7/src/rumget.c Examining data/postgresql-rum-1.3.7/src/ruminsert.c Examining data/postgresql-rum-1.3.7/src/rumscan.c Examining data/postgresql-rum-1.3.7/src/rumsort.c Examining data/postgresql-rum-1.3.7/src/rumsort.h Examining data/postgresql-rum-1.3.7/src/rumtsquery.c Examining data/postgresql-rum-1.3.7/src/rumutil.c Examining data/postgresql-rum-1.3.7/src/rumvacuum.c Examining data/postgresql-rum-1.3.7/src/rumvalidate.c FINAL RESULTS: data/postgresql-rum-1.3.7/src/rumbtree.c:53:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. return access; data/postgresql-rum-1.3.7/src/rumbtree.c:162:57: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. stack->buffer = rumStep(stack->buffer, btree->index, access, data/postgresql-rum-1.3.7/src/rumget.c:1132:31: [3] (random) random: 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. #define rum_rand() (((double) random()) / ((double) MAX_RANDOM_VALUE)) data/postgresql-rum-1.3.7/src/rum.h:959:3: [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(&item->iptr, ptr, sizeof(ItemPointerData)); data/postgresql-rum-1.3.7/src/rum.h:999:6: [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(&u.i16, ptr, sizeof(int16)); data/postgresql-rum-1.3.7/src/rum.h:1003:6: [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(&u.i32, ptr, sizeof(int32)); data/postgresql-rum-1.3.7/src/rum.h:1008:6: [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(&item->addInfo, ptr, sizeof(Datum)); data/postgresql-rum-1.3.7/src/rum.h:1045:3: [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(&item->iptr, ptr, sizeof(ItemPointerData)); data/postgresql-rum-1.3.7/src/rum_ts_utils.c:1629:12: [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. ptrt = (char *) VARDATA_ANY(addInfo[keyN]); data/postgresql-rum-1.3.7/src/rumdatapage.c:87: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, &u.i16, sizeof(int16)); data/postgresql-rum-1.3.7/src/rumdatapage.c:91: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, &u.i32, sizeof(int32)); data/postgresql-rum-1.3.7/src/rumdatapage.c:95: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, &datum, sizeof(Datum)); data/postgresql-rum-1.3.7/src/rumdatapage.c:182:3: [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, &x, sizeof(x)); data/postgresql-rum-1.3.7/src/rumdatapage.c:741:2: [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, data, sizeof(PostingItem)); data/postgresql-rum-1.3.7/src/rumdatapage.c:856: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 pageCopy[BLCKSZ]; data/postgresql-rum-1.3.7/src/rumdatapage.c:875: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(pageCopy + (ptr - page), ptr, BLCKSZ - (ptr - page)); data/postgresql-rum-1.3.7/src/rumdatapage.c:1058: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. static char lpageCopy[BLCKSZ]; data/postgresql-rum-1.3.7/src/rumdatapage.c:1065:2: [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(lpageCopy, newlPage, BLCKSZ); data/postgresql-rum-1.3.7/src/rumdatapage.c:1237: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. static char vector[2 * BLCKSZ]; data/postgresql-rum-1.3.7/src/rumdatapage.c:1243:2: [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(vector, RumDataPageGetItem(newlPage, FirstOffsetNumber), data/postgresql-rum-1.3.7/src/rumdatapage.c:1250:2: [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, &(btree->pitem), sizeofitem); data/postgresql-rum-1.3.7/src/rumdatapage.c:1268:2: [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, vector, separator * sizeofitem); data/postgresql-rum-1.3.7/src/rumdatapage.c:1275:2: [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, vector + separator * sizeofitem, data/postgresql-rum-1.3.7/src/rumentrypage.c:81:3: [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(nitup, itup, origsize); data/postgresql-rum-1.3.7/src/rumentrypage.c:90:3: [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(nitup, itup, IndexTupleSize(itup)); data/postgresql-rum-1.3.7/src/rumentrypage.c:432: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. static char tupstore[2 * BLCKSZ]; data/postgresql-rum-1.3.7/src/rumentrypage.c:444: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(ptr, btree->entry, size); data/postgresql-rum-1.3.7/src/rumentrypage.c:451:3: [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, itup, size); data/postgresql-rum-1.3.7/src/rumentrypage.c:459:3: [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, btree->entry, size); data/postgresql-rum-1.3.7/src/rumget.c:854:3: [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(so->sortedEntries, so->entries, sizeof(RumScanEntry) * data/postgresql-rum-1.3.7/src/rumscan.c:708: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(so->entries + so->totalentries, data/postgresql-rum-1.3.7/src/rumsort.c:2489:2: [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(stup->tuple, tup, sizeof(RumScanItem)); data/postgresql-rum-1.3.7/src/rumtsquery.c:498: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. ptr = (unsigned char *) VARDATA_ANY(DatumGetPointer(addInfo[i])); data/postgresql-rum-1.3.7/src/rumvacuum.c:77:6: [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(dst, src, prev - src); data/postgresql-rum-1.3.7/src/rumvacuum.c:200:3: [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, data, dataSize); data/postgresql-rum-1.3.7/src/rumvacuum.c:262: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(RumDataPageGetData(newPage), cleaned, newSize); data/postgresql-rum-1.3.7/src/rumdatapage.c:144: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). data_length = strlen(DatumGetCString(datum)) + 1; ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 17737 in approximately 0.39 seconds (45524 lines/second) Physical Source Lines of Code (SLOC) = 12272 Hits@level = [0] 0 [1] 1 [2] 33 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 37 [1+] 37 [2+] 36 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 3.01499 [1+] 3.01499 [2+] 2.93351 [3+] 0.244459 [4+] 0.162973 [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.