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/scalpel-1.60/base_name.c Examining data/scalpel-1.60/base_name.h Examining data/scalpel-1.60/dig.c Examining data/scalpel-1.60/dirname.h Examining data/scalpel-1.60/prioque.c Examining data/scalpel-1.60/prioque.h Examining data/scalpel-1.60/scalpel.c Examining data/scalpel-1.60/scalpel.h Examining data/scalpel-1.60/helpers.c Examining data/scalpel-1.60/files.c FINAL RESULTS: data/scalpel-1.60/dig.c:856:2: [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(carveinfo->filename, fn); data/scalpel-1.60/files.c:76:2: [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. fprintf(stderr, NONEMPTYDIR_ERROR_MSG); data/scalpel-1.60/helpers.c:76:3: [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. vfprintf (stderr,format,argp); data/scalpel-1.60/helpers.c:77:3: [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. vfprintf (state->auditFile,format,argp); data/scalpel-1.60/scalpel.c:400:7: [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. fprintf (stdout,SCALPEL_COPYRIGHT_STRING); data/scalpel-1.60/scalpel.c:593:5: [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. fprintf (stderr, SCALPEL_SIZEOFBUFFER_PANIC_STRING); data/scalpel-1.60/scalpel.c:601:3: [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. fprintf (stdout,SCALPEL_BANNER_STRING); data/scalpel-1.60/scalpel.h:85:10: [4] (format) snprintf: 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. #define snprintf _snprintf data/scalpel-1.60/scalpel.h:85:27: [4] (format) _snprintf: 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. #define snprintf _snprintf data/scalpel-1.60/dig.c:197:3: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(state->imagefile,imageFile); data/scalpel-1.60/helpers.c:59:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(s,fn) == NULL) { data/scalpel-1.60/scalpel.c:396:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((i = getopt(argc, argv, "bhvVundpq:rt:c:o:s:i:m:O")) != -1) { data/scalpel-1.60/scalpel.c:500:3: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(state->outputdirectory,fn); data/scalpel-1.60/scalpel.h:92:5: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt(int argc, char *const argv[], const char *optstring); data/scalpel-1.60/scalpel.h:95:9: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. #define realpath(A,B) _fullpath(B,A,PATH_MAX) data/scalpel-1.60/scalpel.h:99:9: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. #define realpath(A,B) \ data/scalpel-1.60/scalpel.h:100:4: [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. (getenv ("CYGWIN_USE_WIN32_PATHS") \ data/scalpel-1.60/scalpel.h:102:6: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. : realpath ((A), (B))) data/scalpel-1.60/dig.c:29: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 readbuffer[SIZE_OF_BUFFER]; // read buffer--process image data/scalpel-1.60/dig.c:97: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 buf[MAX_STRING_LENGTH]; data/scalpel-1.60/dig.c:98: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[MAX_STRING_LENGTH]; data/scalpel-1.60/dig.c:132:5: [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(buf,"bytes"); break; data/scalpel-1.60/dig.c:134:5: [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(buf,"KB"); break; data/scalpel-1.60/dig.c:136:5: [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(buf,"MB"); break; data/scalpel-1.60/dig.c:138:5: [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(buf,"GB"); break; data/scalpel-1.60/dig.c:140:5: [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(buf,"TB"); break; data/scalpel-1.60/dig.c:142:5: [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(buf,"PB"); break; data/scalpel-1.60/dig.c:144:5: [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(buf,"EB"); break; data/scalpel-1.60/dig.c:195: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 imageFile[MAX_STRING_LENGTH]; data/scalpel-1.60/dig.c:455:17: [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). if ((infile = fopen(state->imagefile,"rb")) == NULL) { data/scalpel-1.60/dig.c:575: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 fn[MAX_STRING_LENGTH]; // temp buffer for output filename data/scalpel-1.60/dig.c:576: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 orgdir[MAX_STRING_LENGTH]; // buffer for name of organizing subdirectory data/scalpel-1.60/dig.c:601:17: [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). if ((infile = fopen(state->imagefile,"rb")) == NULL) { data/scalpel-1.60/dig.c:1019:16: [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). carve->fp = fopen(carve->filename,"ab"); data/scalpel-1.60/dig.c:1197: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 fn[MAX_STRING_LENGTH]; // filename for header/footer database data/scalpel-1.60/dig.c:1207:17: [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). if ((dbfile = fopen(fn,"w")) == NULL) { data/scalpel-1.60/dig.c:1321: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 fn[MAX_STRING_LENGTH]; // filename for coverage blockmap data/scalpel-1.60/dig.c:1345:41: [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). empty = ((state->coverageblockmap = fopen(fn,"rb")) == NULL); data/scalpel-1.60/dig.c:1458:38: [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). if ((state->coverageblockmap = fopen(fn,(empty?"w+b":"r+b"))) == NULL) { data/scalpel-1.60/files.c:89: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 fn[MAX_STRING_LENGTH]; data/scalpel-1.60/files.c:98:30: [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). if (!(state->auditFile = fopen(fn,"w"))) { data/scalpel-1.60/helpers.c:119:20: [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. void init_bm_table(char *needle, size_t table[UCHAR_MAX + 1], data/scalpel-1.60/helpers.c:149:1: [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 *bm_needleinhaystack_skipnchars(char *needle, size_t needle_len, data/scalpel-1.60/helpers.c:149:38: [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 *bm_needleinhaystack_skipnchars(char *needle, size_t needle_len, data/scalpel-1.60/helpers.c:150: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 *haystack, size_t haystack_len, data/scalpel-1.60/helpers.c:179:1: [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 *bm_needleinhaystack(char *needle, size_t needle_len, data/scalpel-1.60/helpers.c:179:27: [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 *bm_needleinhaystack(char *needle, size_t needle_len, data/scalpel-1.60/helpers.c:180:27: [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 *haystack, size_t haystack_len, data/scalpel-1.60/helpers.c:215: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 temp[1+3+1]; data/scalpel-1.60/prioque.c:130: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(new_element->info, element, q->elementsize); data/scalpel-1.60/prioque.c:196: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(element, q->queue->info, q->elementsize); data/scalpel-1.60/prioque.c:227: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(element, (q->current)->info, q->elementsize); data/scalpel-1.60/prioque.c:302: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(q->current->info, element, q->elementsize); data/scalpel-1.60/prioque.c:455: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(new_element->info, temp->info, q1->elementsize); data/scalpel-1.60/prioque.c:569: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(element, (ctx->current)->info, ctx->queue->elementsize); data/scalpel-1.60/prioque.c:643: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(ctx->current->info, element, ctx->queue->elementsize); data/scalpel-1.60/scalpel.c:110: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(s->suffix,tokenarray[0],MAX_SUFFIX_LENGTH); data/scalpel-1.60/scalpel.c:139: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(s->begin,tokenarray[3],s->beginlength); data/scalpel-1.60/scalpel.c:141: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(s->end,tokenarray[4],s->endlength); data/scalpel-1.60/scalpel.c:157:24: [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 **tokenarray = (char **) malloc(6*sizeof(char[MAX_STRING_LENGTH+1])); data/scalpel-1.60/scalpel.c:244:7: [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). f = fopen(state->conffile,"r"); data/scalpel-1.60/scalpel.c:498: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 fn[MAX_STRING_LENGTH]; data/scalpel-1.60/scalpel.c:520:19: [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). listoffiles = fopen(state->inputFileList,"r"); data/scalpel-1.60/scalpel.h:341:20: [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. void init_bm_table(char *needle, size_t table[UCHAR_MAX + 1], data/scalpel-1.60/scalpel.h:345:1: [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 *bm_needleinhaystack(char *needle, size_t needle_len, data/scalpel-1.60/scalpel.h:345:27: [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 *bm_needleinhaystack(char *needle, size_t needle_len, data/scalpel-1.60/scalpel.h:346:27: [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 *haystack, size_t haystack_len, data/scalpel-1.60/base_name.c:73:14: [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 (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) data/scalpel-1.60/dig.c:153: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). barlength = ttywidth - strlen(fn) - strlen(buf) - 32; data/scalpel-1.60/dig.c:153: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). barlength = ttywidth - strlen(fn) - strlen(buf) - 32; data/scalpel-1.60/dig.c:854: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). carveinfo->filename=malloc(strlen(fn)+1); data/scalpel-1.60/files.c:138:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &ch, 1) < 1) { data/scalpel-1.60/helpers.c:247:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temp+1,rd,3); data/scalpel-1.60/scalpel.c:105:20: [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(SCALPEL_NOEXTENSION_SUFFIX))) { data/scalpel-1.60/scalpel.c:127:44: [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 (!strncasecmp(tokenarray[5],"REVERSE",strlen("REVERSE"))) { data/scalpel-1.60/scalpel.c:130: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). else if (!strncasecmp(tokenarray[5],"NEXT",strlen("NEXT"))) { data/scalpel-1.60/scalpel.c:134:49: [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). else if (!strncasecmp(tokenarray[5],"FORWARD",strlen("FORWARD"))) { data/scalpel-1.60/scalpel.c:158: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). int i = 0, err=0, len = strlen(buffer); data/scalpel-1.60/scalpel.c:185:9: [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(token) > 1) { data/scalpel-1.60/scalpel.c:189: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). (int)strlen(token),token[0]); data/scalpel-1.60/scalpel.c:368:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->outputdirectory,SCALPEL_DEFAULT_OUTPUT_DIR, data/scalpel-1.60/scalpel.c:369:4: [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(SCALPEL_DEFAULT_OUTPUT_DIR)); data/scalpel-1.60/scalpel.c:370:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->conffile,SCALPEL_DEFAULT_CONFIG_FILE, data/scalpel-1.60/scalpel.c:379:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(state->invocation, data/scalpel-1.60/scalpel.c:381:24: [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). MAX_STRING_LENGTH-strlen(state->invocation)); data/scalpel-1.60/scalpel.c:382:5: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(state->invocation, data/scalpel-1.60/scalpel.c:384:24: [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). MAX_STRING_LENGTH-strlen(state->invocation)); data/scalpel-1.60/scalpel.c:414:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->conffile,optarg,MAX_STRING_LENGTH); data/scalpel-1.60/scalpel.c:437:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->outputdirectory,optarg,MAX_STRING_LENGTH); data/scalpel-1.60/scalpel.c:442:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->coveragedirectory,optarg,MAX_STRING_LENGTH); data/scalpel-1.60/scalpel.c:501:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->outputdirectory,fn,MAX_STRING_LENGTH); data/scalpel-1.60/scalpel.c:539: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). if(state->imagefile[strlen(state->imagefile)-1] == '\n'){ data/scalpel-1.60/scalpel.c:540:19: [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). state->imagefile[strlen(state->imagefile)-1] = '\x00'; ANALYSIS SUMMARY: Hits = 93 Lines analyzed = 4765 in approximately 0.16 seconds (29903 lines/second) Physical Source Lines of Code (SLOC) = 2938 Hits@level = [0] 241 [1] 26 [2] 49 [3] 9 [4] 9 [5] 0 Hits@level+ = [0+] 334 [1+] 93 [2+] 67 [3+] 18 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 113.683 [1+] 31.6542 [2+] 22.8046 [3+] 6.12662 [4+] 3.06331 [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.