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/dds2tar-2.5.2/dds2tar.h Examining data/dds2tar-2.5.2/zf-cre-open.h Examining data/dds2tar-2.5.2/zf-cre-open.c Examining data/dds2tar-2.5.2/dds_index.c Examining data/dds2tar-2.5.2/dds_tape.h Examining data/dds2tar-2.5.2/dds_tape.c Examining data/dds2tar-2.5.2/dds_chkhdr.c Examining data/dds2tar-2.5.2/dds_quote.c Examining data/dds2tar-2.5.2/dds2tar.c Examining data/dds2tar-2.5.2/dds_extract.c FINAL RESULTS: data/dds2tar-2.5.2/dds2tar.c:340:7: [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. f = popen(cmd,"r"); data/dds2tar-2.5.2/dds2tar.c:357:4: [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, p, pathname); data/dds2tar-2.5.2/dds2tar.c:665:38: [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 R(c) if ( 0 != geteuid() ) { fprintf(stderr,\ data/dds2tar-2.5.2/dds2tar.c:787:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(dds_loctext, tar_fb, tar_bs, cur_n); data/dds2tar-2.5.2/dds_extract.c:528:4: [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(dp->n, name); data/dds2tar-2.5.2/dds_index.c:87:4: [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(index_fp, dds_index_format, data/dds2tar-2.5.2/dds_index.c:108:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(cur_line, dds_index_format, data/dds2tar-2.5.2/dds_index.c:161:11: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if ((i = sscanf(cur_line, data/dds2tar-2.5.2/zf-cre-open.c:66:4: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(b, name); data/dds2tar-2.5.2/zf-cre-open.c:71:4: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(b, name); data/dds2tar-2.5.2/zf-cre-open.c:74:7: [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. fp = popen(b, open_mode); data/dds2tar-2.5.2/zf-cre-open.c:161:3: [4] (shell) execv: 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. execv(filename, (char *const *) argv); data/dds2tar-2.5.2/dds2tar.c:402: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. if ((p = getenv("TAPE")) != NULL) data/dds2tar-2.5.2/dds2tar.c:425:6: [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. p = getenv("DDS2TAR"); data/dds2tar-2.5.2/dds2tar.c:59: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 vendor[9] = "\0\0\0\0\0\0\0\0\0" ; data/dds2tar-2.5.2/dds2tar.c:234: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 long_name[MAXPATHLEN<<2] = { '\0' }; data/dds2tar-2.5.2/dds2tar.c:242:12: [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). tar_fb = atoi(cur_line + 45); data/dds2tar-2.5.2/dds2tar.c:245:12: [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). tar_fb = atoi(cur_line + 21); data/dds2tar-2.5.2/dds2tar.c:248:11: [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). tar_n = atoi(cur_line + 31); data/dds2tar-2.5.2/dds2tar.c:252:12: [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). tar_bs = atoi(cur_line + 13); data/dds2tar-2.5.2/dds2tar.c:256:11: [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). tar_n = atoi(cur_line + 15) ; data/dds2tar-2.5.2/dds2tar.c:336: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 cmd[100]; data/dds2tar-2.5.2/dds2tar.c:339: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(cmd,"scsi_vendor tape %d",(int)(s.st_rdev&0x7f)+1); data/dds2tar-2.5.2/dds2tar.c:353:13: [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 ((fd = open(pathname, open_mode)) >= 0) data/dds2tar-2.5.2/dds2tar.c:514:13: [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). tar_fb = atoi(argv[++n]); data/dds2tar-2.5.2/dds2tar.c:517:13: [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). tar_bs = atoi(argv[++n]); data/dds2tar-2.5.2/dds2tar.c:522:13: [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). tar_bs = atoi(argv[++n]); data/dds2tar-2.5.2/dds2tar.c:607: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. static char const *const a[5] = data/dds2tar-2.5.2/dds2tar.c:615: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. static char const *const a[5] = data/dds2tar-2.5.2/dds2tar.c:623: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. static char const *const a[5] = data/dds2tar-2.5.2/dds2tar.c:657:14: [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). int j = atoi(argv[2]); data/dds2tar-2.5.2/dds2tar.h:38: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. extern char vendor[9]; data/dds2tar-2.5.2/dds2tar.h:49: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 chrptr[512]; data/dds2tar-2.5.2/dds2tar.h:51: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]; data/dds2tar-2.5.2/dds2tar.h:52: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 dummy1[24]; data/dds2tar-2.5.2/dds2tar.h:53: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 size[12]; data/dds2tar-2.5.2/dds2tar.h:54: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 mtime[12]; data/dds2tar-2.5.2/dds2tar.h:55: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 dummy2[8]; data/dds2tar-2.5.2/dds2tar.h:57: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 dummy3[100]; data/dds2tar-2.5.2/dds2tar.h:58: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 magic[8]; data/dds2tar-2.5.2/dds2tar.h:90: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. extern char long_name[MAXPATHLEN<<2]; data/dds2tar-2.5.2/dds_chkhdr.c:29: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(p+148 , "%o", n ); data/dds2tar-2.5.2/dds_extract.c:290: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 n[128-2*sizeof(int)]; /* name of the dir */ data/dds2tar-2.5.2/dds_extract.c:439:13: [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). recno = atoi(cur_line + 4); data/dds2tar-2.5.2/dds_index.c:84:13: [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. while ((((char *) ptr)[i] == 0) && (i < 512)) data/dds2tar-2.5.2/dds_index.c:143: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 p[16]; data/dds2tar-2.5.2/dds_index.c:224: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(long_name+((i++)<<9), data/dds2tar-2.5.2/dds_tape.c:377:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(comp_page[i].buf, arg->buf, arg->inlen); data/dds2tar-2.5.2/zf-cre-open.c:50:9: [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). fp = fopen(name, open_mode); data/dds2tar-2.5.2/zf-cre-open.c:63:3: [2] (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). Risk is low because the source is a constant string. strcpy(b, "gzip "); data/dds2tar-2.5.2/zf-cre-open.c:65:4: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(b, " > "); data/dds2tar-2.5.2/zf-cre-open.c:69:3: [2] (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). Risk is low because the source is a constant string. strcpy(b, "gunzip --force --decompress --stdout "); data/dds2tar-2.5.2/zf-cre-open.c:109:13: [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 ((fd = open(output_file, mode, flags)) == -1) { data/dds2tar-2.5.2/dds2tar.c:390: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). int l = strlen(argv[0]); data/dds2tar-2.5.2/dds_extract.c:517:7: [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). i = strlen(name) -1 ; data/dds2tar-2.5.2/dds_extract.c:578:28: [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 ( 0==strncmp(ll,name,strlen(name)) ){ data/dds2tar-2.5.2/dds_tape.c:123:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). err = read(device, ((char *) cur_block) + cur_n, data/dds2tar-2.5.2/dds_tape.c:128:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). err = read(device, cur_block, buf_n); data/dds2tar-2.5.2/dds_tape.c:153:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). err = read(device, cur_block, tar_n); ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 2668 in approximately 0.11 seconds (23948 lines/second) Physical Source Lines of Code (SLOC) = 1898 Hits@level = [0] 91 [1] 6 [2] 39 [3] 2 [4] 12 [5] 0 Hits@level+ = [0+] 150 [1+] 59 [2+] 53 [3+] 14 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 79.0306 [1+] 31.0854 [2+] 27.9241 [3+] 7.37619 [4+] 6.32244 [5+] 0 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.