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/pipemeter-1.1.3/pipemeter.c FINAL RESULTS: data/pipemeter-1.1.3/pipemeter.c:400: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,trailer); data/pipemeter-1.1.3/pipemeter.c:490: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(stderr, progressbar); data/pipemeter-1.1.3/pipemeter.c:500: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,trailer); data/pipemeter-1.1.3/pipemeter.c:902: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(filenames[filenames_count],path); data/pipemeter-1.1.3/pipemeter.c:212:10: [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. colstr=getenv("COLUMNS"); data/pipemeter-1.1.3/pipemeter.c:214:34: [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. columns=(unsigned int)strtol(getenv("COLUMNS"),NULL,10); data/pipemeter-1.1.3/pipemeter.c:543:7: [3] (buffer) getopt_long: 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. c=getopt_long(argc,argv,"f:s:b:i:m:F:rVal",longopts,NULL); data/pipemeter-1.1.3/pipemeter.c:545:7: [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. c=getopt(argc,argv,"f:s:b:i:m:F:rVal"); data/pipemeter-1.1.3/pipemeter.c:177: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). in = open(filenames[thisfile], O_RDONLY); data/pipemeter-1.1.3/pipemeter.c:290: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). in = open(filenames[thisfile], O_RDONLY); data/pipemeter-1.1.3/pipemeter.c:360: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 numbuf[512]; // XXX: hrm... bad form, but so much simpler data/pipemeter-1.1.3/pipemeter.c:361: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 timebuf[10]; data/pipemeter-1.1.3/pipemeter.c:443: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 buf2[512]; // XXX: hopefully we fix them before there are 100 or so data/pipemeter-1.1.3/pipemeter.c:449: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 etabuf[10]; // Seriously, I dare you to overflow it data/pipemeter-1.1.3/pipemeter.c:507: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 listline[MAX_LINE]; data/pipemeter-1.1.3/pipemeter.c:572: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). listfile=fopen(optarg,"r"); data/pipemeter-1.1.3/pipemeter.c:629: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(obuffer,"%7.2fG",tmp); data/pipemeter-1.1.3/pipemeter.c:632: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(obuffer,"%7.2fM",tmp); data/pipemeter-1.1.3/pipemeter.c:635: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(obuffer,"%7.2fk",tmp); data/pipemeter-1.1.3/pipemeter.c:637: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(obuffer,"%7.2fB",b); data/pipemeter-1.1.3/pipemeter.c:292:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((bytesin=read(in,buffer,block_size))) { data/pipemeter-1.1.3/pipemeter.c:489:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(progressbar+1,progressfill,progress); data/pipemeter-1.1.3/pipemeter.c:581: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). if(listline[strlen(listline)-1]=='\n') { data/pipemeter-1.1.3/pipemeter.c:582: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). listline[strlen(listline)-1]='\0'; // remove newline data/pipemeter-1.1.3/pipemeter.c:817:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(outbuf,"---:--:--",outbufsize-1); data/pipemeter-1.1.3/pipemeter.c:855: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). switch(optarg[strlen(optarg) - 1]) { data/pipemeter-1.1.3/pipemeter.c:865: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). optarg[strlen(optarg) - 1] = '\0'; data/pipemeter-1.1.3/pipemeter.c:894:59: [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). filenames[filenames_count]=(char *)malloc(sizeof(char)*(strlen(path)+1)); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 904 in approximately 0.03 seconds (27114 lines/second) Physical Source Lines of Code (SLOC) = 651 Hits@level = [0] 30 [1] 8 [2] 12 [3] 4 [4] 4 [5] 0 Hits@level+ = [0+] 58 [1+] 28 [2+] 20 [3+] 8 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 89.0937 [1+] 43.0108 [2+] 30.722 [3+] 12.2888 [4+] 6.14439 [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.