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/r-cran-boolnet-2.1.5/src/boolean_network.h Examining data/r-cran-boolnet-2.1.5/src/common.h Examining data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c Examining data/r-cran-boolnet-2.1.5/src/statespace_search.h Examining data/r-cran-boolnet-2.1.5/src/common.c Examining data/r-cran-boolnet-2.1.5/src/picosat.h Examining data/r-cran-boolnet-2.1.5/src/sat_search.h Examining data/r-cran-boolnet-2.1.5/src/attractor_info.c Examining data/r-cran-boolnet-2.1.5/src/random.h Examining data/r-cran-boolnet-2.1.5/src/uthash.h Examining data/r-cran-boolnet-2.1.5/src/symbolic_network.h Examining data/r-cran-boolnet-2.1.5/src/sat_search.c Examining data/r-cran-boolnet-2.1.5/src/statespace_search.c Examining data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c Examining data/r-cran-boolnet-2.1.5/src/picosat.c Examining data/r-cran-boolnet-2.1.5/src/probabilistic_boolean_network.c Examining data/r-cran-boolnet-2.1.5/src/symbolic_network.c Examining data/r-cran-boolnet-2.1.5/src/attractor_info.h Examining data/r-cran-boolnet-2.1.5/src/init.c Examining data/r-cran-boolnet-2.1.5/src/reconstruct_network.c FINAL RESULTS: data/r-cran-boolnet-2.1.5/src/picosat.c:381:46: [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 picosat_fprintf(file, fmt, ...) do { fprintf(file, fmt, ##__VA_ARGS__); } while (0) data/r-cran-boolnet-2.1.5/src/picosat.c:382:51: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define picosat_vfprintf(file, fmt, va_list) do { vfprintf(file, fmt, va_list); } while (0) data/r-cran-boolnet-2.1.5/src/picosat.c:1176: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 (ps->prefix, str); data/r-cran-boolnet-2.1.5/src/picosat.c:1264:19: [4] (shell) popen: 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. ps->fviscores = popen ( data/r-cran-boolnet-2.1.5/src/picosat.c:1273:3: [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. system ("rm -rf /tmp/picosat-viscores"); data/r-cran-boolnet-2.1.5/src/picosat.c:1274:3: [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. system ("mkdir /tmp/picosat-viscores"); data/r-cran-boolnet-2.1.5/src/picosat.c:1275:3: [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. system ("mkdir /tmp/picosat-viscores/data"); data/r-cran-boolnet-2.1.5/src/picosat.c:1277:3: [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. system ("mkdir /tmp/picosat-viscores/gif"); data/r-cran-boolnet-2.1.5/src/picosat.c:3272:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (ps->rline[1], "%6s", ""); data/r-cran-boolnet-2.1.5/src/picosat.c:3284:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (ps->rline[x] + y, fmt, name, ""); data/r-cran-boolnet-2.1.5/src/picosat.c:4397:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (cmd, "sort -n|nl>%s", name); data/r-cran-boolnet-2.1.5/src/picosat.c:4399:10: [4] (shell) popen: 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. data = popen (cmd, "w"); data/r-cran-boolnet-2.1.5/src/picosat.c:4413:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (cmd, "awk '$3%%8==%d' %s>%s.%d", i, name, name, i); data/r-cran-boolnet-2.1.5/src/picosat.c:4414:7: [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. system (cmd); data/r-cran-boolnet-2.1.5/src/uthash.h:251:29: [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 HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) data/r-cran-boolnet-2.1.5/src/picosat.c:1540:11: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. assert (getenv ("LEAK") || !ps->current_bytes); /* found leak if failing */ data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:180: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(&array[i * res->numElementsPerEntry], data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:191: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(array, res->attractorAssignment, res->tableSize * sizeof(int)); data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:199: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(array, res->stepsToAttractor, res->tableSize * sizeof(int)); data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:220: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(&array[i * res->numElementsPerEntry], data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:273:13: [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(&array[i * el->numElementsPerEntry], data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:303:17: [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(&initial[i * el->numElementsPerEntry], data/r-cran-boolnet-2.1.5/src/attractor_search_interface.c:306:17: [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(&next[i * el->numElementsPerEntry], data/r-cran-boolnet-2.1.5/src/picosat.c:504: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 data[BLK_FILL_BYTES]; data/r-cran-boolnet-2.1.5/src/picosat.c:606: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 *rline[2]; data/r-cran-boolnet-2.1.5/src/picosat.c:2181: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 (res->znt, ps->buffer, count); data/r-cran-boolnet-2.1.5/src/picosat.c:2271: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 line[80]; data/r-cran-boolnet-2.1.5/src/picosat.c:2274: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 (line, "%%RUPD32 %u %u", ps->rupvariables, ps->rupclauses); data/r-cran-boolnet-2.1.5/src/picosat.c:3521:12: [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). unsigned open, minlevel, siglevels, l, old, i, orig; data/r-cran-boolnet-2.1.5/src/picosat.c:3617:12: [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 ((!open && ps->LEVEL) || !c) data/r-cran-boolnet-2.1.5/src/picosat.c:4382: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 name[100], cmd[200]; data/r-cran-boolnet-2.1.5/src/picosat.c:4396: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 (name, "/tmp/picosat-viscores/data/%08u", ps->conflicts); data/r-cran-boolnet-2.1.5/src/probabilistic_boolean_network.c:356: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(oldOutcome,outcome,sizeof(double) * tableSize); data/r-cran-boolnet-2.1.5/src/probabilistic_boolean_network.c:434: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(network.fixedGenes,INTEGER(fixedGenes),sizeof(unsigned int) * network.numGenes); data/r-cran-boolnet-2.1.5/src/probabilistic_boolean_network.c:476: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(current->inputGenes,&_inputGenes[_inputGenePositions[i]],numInputs*sizeof(int)); data/r-cran-boolnet-2.1.5/src/probabilistic_boolean_network.c:481: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(current->transitionFunction,&_transitionFunctions[_transitionFunctionPositions[i]], data/r-cran-boolnet-2.1.5/src/reconstruct_network.c:94: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(el->inputGenes,inputGenes,sizeof(unsigned int) * k); data/r-cran-boolnet-2.1.5/src/reconstruct_network.c:97: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(el->transitionFunction,transitionFunction,sizeof(unsigned int) * transitionFunctionSize); data/r-cran-boolnet-2.1.5/src/reconstruct_network.c:141: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(el->transitionFunction,transitionFunction,sizeof(unsigned int) * transitionFunctionSize); data/r-cran-boolnet-2.1.5/src/reconstruct_network.c:792: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(comb_output,comb->comb,sizeof(unsigned int) * k); data/r-cran-boolnet-2.1.5/src/reconstruct_network.c:1072: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(array,(int*)cur->transitionFunction,numBits*sizeof(int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:106: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(entry->initialState,initialState,numElements*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:107: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(entry->nextState,nextState,numElements*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:199: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(res->data,data,numElements*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:331: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(&initialStates[numElements* (*nodeNo)],root->data,numElements*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:332: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(&table[numElements* (*nodeNo)],root->type.sync.successor->data,numElements*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:771: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(&attractorList->involvedStates[a],tmp->data,elementsPerEntry*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:857: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(el->state,state,sizeof(unsigned int) * numElements); data/r-cran-boolnet-2.1.5/src/statespace_search.c:991: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(origstate,stack->state,sizeof(unsigned int) * numElements); data/r-cran-boolnet-2.1.5/src/statespace_search.c:1008: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(&successorStates[i*numElements],origstate,sizeof(unsigned int) * numElements); data/r-cran-boolnet-2.1.5/src/statespace_search.c:1064: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(state,origstate,sizeof(unsigned int) * numElements); data/r-cran-boolnet-2.1.5/src/statespace_search.c:1098: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(&states[numElements* (*nodeNo)],root->data,numElements*sizeof(unsigned int)); data/r-cran-boolnet-2.1.5/src/statespace_search.c:1241: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(currentState,&selectedStates[i*numElts],sizeof(unsigned int) * numElts); data/r-cran-boolnet-2.1.5/src/statespace_search.c:1281: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(attractor->involvedStates,states_set,sizeof(unsigned int) * numElts * set->nodeCount); data/r-cran-boolnet-2.1.5/src/symbolic_network.c:287: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(res, formula, sizeof(BooleanAtom)); data/r-cran-boolnet-2.1.5/src/symbolic_network.c:297: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(res, formula, sizeof(Constant)); data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:262: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(res->initialState, nextState, data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:311: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(res->state, state, data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:416: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(&nextState->state[network->stateOffsets[i] + 1], data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:1037: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(current, currentStart, data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:1112: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(current, next, data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:1162: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(INTEGER(attractorIndexSXP), attractorIndices, data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:1214: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(currentStart->state, data/r-cran-boolnet-2.1.5/src/symbolic_simulator.c:1267: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(current, currentStart, data/r-cran-boolnet-2.1.5/src/picosat.c:1166: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). delete (ps, ps->prefix, strlen (ps->prefix) + 1); data/r-cran-boolnet-2.1.5/src/picosat.c:1175: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). ps->prefix = new (ps, strlen (str) + 1); data/r-cran-boolnet-2.1.5/src/picosat.c:2277: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). for (i = 255 - strlen (line); i >= 0; i--) data/r-cran-boolnet-2.1.5/src/picosat.c:3241:23: [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). p = ps->rline[x] + strlen (ps->rline[x]); data/r-cran-boolnet-2.1.5/src/picosat.c:3274:13: [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). len = strlen (name); data/r-cran-boolnet-2.1.5/src/picosat.c:4428:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep (50000); /* refresh rate of 20 Hz */ data/r-cran-boolnet-2.1.5/src/uthash.h:233:31: [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). HASH_FIND(hh,head,findstr,strlen(findstr),out) data/r-cran-boolnet-2.1.5/src/uthash.h:235:31: [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). HASH_ADD(hh,head,strfield,strlen(add->strfield),add) ANALYSIS SUMMARY: Hits = 72 Lines analyzed = 17314 in approximately 0.38 seconds (45656 lines/second) Physical Source Lines of Code (SLOC) = 12463 Hits@level = [0] 0 [1] 8 [2] 48 [3] 1 [4] 15 [5] 0 Hits@level+ = [0+] 72 [1+] 72 [2+] 64 [3+] 16 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 5.7771 [1+] 5.7771 [2+] 5.1352 [3+] 1.2838 [4+] 1.20356 [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.