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/libtar-1.2.20/compat/compat.h Examining data/libtar-1.2.20/compat/fnmatch.c Examining data/libtar-1.2.20/compat/gethostbyname_r.c Examining data/libtar-1.2.20/compat/gethostname.c Examining data/libtar-1.2.20/compat/getservbyname_r.c Examining data/libtar-1.2.20/compat/glob.c Examining data/libtar-1.2.20/compat/inet_aton.c Examining data/libtar-1.2.20/compat/snprintf.c Examining data/libtar-1.2.20/compat/strdup.c Examining data/libtar-1.2.20/compat/strlcat.c Examining data/libtar-1.2.20/compat/strlcpy.c Examining data/libtar-1.2.20/compat/strmode.c Examining data/libtar-1.2.20/compat/strrstr.c Examining data/libtar-1.2.20/compat/strsep.c Examining data/libtar-1.2.20/compat/basename.c Examining data/libtar-1.2.20/compat/dirname.c Examining data/libtar-1.2.20/lib/block.c Examining data/libtar-1.2.20/lib/encode.c Examining data/libtar-1.2.20/lib/handle.c Examining data/libtar-1.2.20/lib/append.c Examining data/libtar-1.2.20/lib/util.c Examining data/libtar-1.2.20/lib/wrapper.c Examining data/libtar-1.2.20/lib/extract.c Examining data/libtar-1.2.20/lib/internal.h Examining data/libtar-1.2.20/lib/output.c Examining data/libtar-1.2.20/lib/libtar.h Examining data/libtar-1.2.20/lib/decode.c Examining data/libtar-1.2.20/libtar/libtar.c FINAL RESULTS: data/libtar-1.2.20/lib/append.c:149:7: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. i = readlink(realname, path, s.st_size); data/libtar-1.2.20/lib/extract.c:57:23: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (!TH_ISSYM(t) && chown(filename, uid, gid) == -1) data/libtar-1.2.20/lib/extract.c:77:22: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (!TH_ISSYM(t) && chmod(filename, mode) == -1) data/libtar-1.2.20/lib/extract.c:465:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(filename, mode) == -1) data/libtar-1.2.20/compat/compat.h:202:9: [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 mutt_snprintf data/libtar-1.2.20/compat/compat.h:203:9: [4] (format) vsnprintf: 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 vsnprintf mutt_vsnprintf data/libtar-1.2.20/compat/dirname.c:74:9: [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). (void)strcpy(bname, *endp == '/' ? "/" : "."); data/libtar-1.2.20/compat/snprintf.c:734:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf2, fp_fmt[x], fp_nums[y]); data/libtar-1.2.20/compat/snprintf.c:748:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf2, int_fmt[x], int_nums[y]); data/libtar-1.2.20/lib/extract.c:140: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(&lnp[0], th_get_pathname(t)); data/libtar-1.2.20/lib/extract.c:141: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(&lnp[pathname_len], realname); data/libtar-1.2.20/lib/util.c:114:3: [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(dst, dirp); data/libtar-1.2.20/lib/wrapper.c:49:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s/%s", prefix, filename); data/libtar-1.2.20/lib/wrapper.c:56: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(buf, filename); data/libtar-1.2.20/lib/wrapper.c:96:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s/%s", prefix, filename); data/libtar-1.2.20/lib/wrapper.c:103: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(buf, filename); data/libtar-1.2.20/compat/glob.c:374:32: [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 (issetugid() != 0 || (h = getenv("HOME")) == NULL) { data/libtar-1.2.20/lib/wrapper.c:161:12: [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. snprintf(realpath, len + 1, "%s/%s", realdir, data/libtar-1.2.20/lib/wrapper.c:167:10: [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. free(realpath); data/libtar-1.2.20/lib/wrapper.c:174:13: [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 (lstat(realpath, &s) != 0) data/libtar-1.2.20/lib/wrapper.c:179:27: [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 (tar_append_tree(t, realpath, data/libtar-1.2.20/lib/wrapper.c:182:10: [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. free(realpath); data/libtar-1.2.20/lib/wrapper.c:189:26: [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 (tar_append_file(t, realpath, data/libtar-1.2.20/lib/wrapper.c:192: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. free(realpath); data/libtar-1.2.20/lib/wrapper.c:196:8: [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. free(realpath); data/libtar-1.2.20/libtar/libtar.c:308:14: [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 ((c = getopt(argc, argv, "cC:gtvVxz")) != -1) data/libtar-1.2.20/compat/glob.c:368: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. if (((char *) patbuf)[0] == EOS) { data/libtar-1.2.20/compat/glob.c:587: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 buf[MAXPATHLEN]; data/libtar-1.2.20/compat/glob.c:772: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 buf[MAXPATHLEN]; data/libtar-1.2.20/compat/glob.c:791: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 buf[MAXPATHLEN]; data/libtar-1.2.20/compat/glob.c:805: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 buf[MAXPATHLEN]; data/libtar-1.2.20/compat/snprintf.c:401: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 convert[20]; data/libtar-1.2.20/compat/snprintf.c:526: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 iconvert[20]; data/libtar-1.2.20/compat/snprintf.c:527: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 fconvert[20]; data/libtar-1.2.20/compat/snprintf.c:693: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 buf1[LONG_STRING]; data/libtar-1.2.20/compat/snprintf.c:694: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[LONG_STRING]; data/libtar-1.2.20/compat/strdup.c:60:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(copy, str, siz); data/libtar-1.2.20/lib/append.c:196: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 block[T_BLOCKSIZE]; data/libtar-1.2.20/lib/append.c:218: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 block[T_BLOCKSIZE]; data/libtar-1.2.20/lib/append.c:223:11: [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). filefd = open(realname, O_RDONLY); data/libtar-1.2.20/lib/block.c:264: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 buf[T_BLOCKSIZE]; data/libtar-1.2.20/lib/decode.c:81: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(t->th_pathname, "%.100s", t->th_buf.name); data/libtar-1.2.20/lib/decode.c:85: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(t->th_pathname, "%.155s/%.100s", data/libtar-1.2.20/lib/encode.c:73: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 suffix[2] = ""; data/libtar-1.2.20/lib/encode.c:129: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(t->th_buf.linkname, "././@LongLink"); data/libtar-1.2.20/lib/extract.c:163: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 buf[T_BLOCKSIZE]; data/libtar-1.2.20/lib/extract.c:190:10: [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). fdout = open(filename, O_WRONLY | O_CREAT | O_TRUNC data/libtar-1.2.20/lib/extract.c:258: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 buf[T_BLOCKSIZE]; data/libtar-1.2.20/lib/handle.c:30:35: [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). static tartype_t default_type = { open, close, read, write }; data/libtar-1.2.20/lib/libtar.h:41: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 name[100]; data/libtar-1.2.20/lib/libtar.h:42: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 mode[8]; data/libtar-1.2.20/lib/libtar.h:43: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 uid[8]; data/libtar-1.2.20/lib/libtar.h:44: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 gid[8]; data/libtar-1.2.20/lib/libtar.h:45: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 size[12]; data/libtar-1.2.20/lib/libtar.h:46: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 mtime[12]; data/libtar-1.2.20/lib/libtar.h:47: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 chksum[8]; data/libtar-1.2.20/lib/libtar.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 linkname[100]; data/libtar-1.2.20/lib/libtar.h:50: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 magic[6]; data/libtar-1.2.20/lib/libtar.h:51: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 version[2]; data/libtar-1.2.20/lib/libtar.h:52: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 uname[32]; data/libtar-1.2.20/lib/libtar.h:53: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 gname[32]; data/libtar-1.2.20/lib/libtar.h:54: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 devmajor[8]; data/libtar-1.2.20/lib/libtar.h:55: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 devminor[8]; data/libtar-1.2.20/lib/libtar.h:56: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 prefix[155]; data/libtar-1.2.20/lib/libtar.h:57: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 padding[12]; data/libtar-1.2.20/lib/output.c:65: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 modestring[12]; data/libtar-1.2.20/lib/output.c:70: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 username[_POSIX_LOGIN_NAME_MAX]; data/libtar-1.2.20/lib/output.c:71: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 groupname[_POSIX_LOGIN_NAME_MAX]; data/libtar-1.2.20/lib/output.c:76: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 timebuf[18]; data/libtar-1.2.20/libtar/libtar.c:81:7: [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). fd = open(pathname, oflags, mode); data/libtar-1.2.20/compat/basename.c:59:9: [1] (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 character. (void)strcpy(bname, "."); data/libtar-1.2.20/compat/basename.c:64:16: [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). endp = path + strlen(path) - 1; data/libtar-1.2.20/compat/basename.c:70:9: [1] (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 character. (void)strcpy(bname, "/"); data/libtar-1.2.20/compat/basename.c:91:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(bname, startp, len); data/libtar-1.2.20/compat/dirname.c:59:9: [1] (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 character. (void)strcpy(bname, "."); data/libtar-1.2.20/compat/dirname.c:64:16: [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). endp = path + strlen(path) - 1; data/libtar-1.2.20/compat/dirname.c:94:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(bname, path, len); data/libtar-1.2.20/compat/gethostname.c:31:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, u.nodename, len); data/libtar-1.2.20/compat/glob.c:775:3: [1] (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 character. strcpy(buf, "."); data/libtar-1.2.20/compat/snprintf.c:669:10: [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). return(strlen(str)); data/libtar-1.2.20/compat/snprintf.c:684:10: [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). return(strlen(str)); data/libtar-1.2.20/compat/strdup.c:57:8: [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). siz = strlen(str) + 1; data/libtar-1.2.20/compat/strlcat.c:61: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). return(dlen + strlen(s)); data/libtar-1.2.20/compat/strrstr.c:28:12: [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). findlen = strlen(find); data/libtar-1.2.20/compat/strrstr.c:29: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). stringlen = strlen(string); data/libtar-1.2.20/lib/append.c:136:51: [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). ti = (tar_ino_t *)calloc(1, sizeof(tar_ino_t) + strlen(name) + 1); data/libtar-1.2.20/lib/append.c:140: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). snprintf(ti->ti_name, strlen(name) + 1, "%s", name); data/libtar-1.2.20/lib/append.c:235:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). j = read(filefd, &block, T_BLOCKSIZE); data/libtar-1.2.20/lib/append.c:248:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). j = read(filefd, &block, i); data/libtar-1.2.20/lib/block.c:227: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). && t->th_buf.name[strlen(t->th_buf.name) - 1] == '/') data/libtar-1.2.20/lib/block.c:283:8: [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). sz = strlen(t->th_buf.gnu_longlink); data/libtar-1.2.20/lib/block.c:308:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, ptr, T_BLOCKSIZE); data/libtar-1.2.20/lib/block.c:334:8: [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). sz = strlen(t->th_buf.gnu_longname); data/libtar-1.2.20/lib/block.c:359:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, ptr, T_BLOCKSIZE); data/libtar-1.2.20/lib/decode.c:152: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). if (t->th_buf.name[strlen(t->th_buf.name) - 1] == '/') data/libtar-1.2.20/lib/encode.c:37:3: [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(t->th_buf.magic, "ustar ", 6); data/libtar-1.2.20/lib/encode.c:38:3: [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 character. strncpy(t->th_buf.version, " ", 2); data/libtar-1.2.20/lib/encode.c:42:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(t->th_buf.version, TVERSION, TVERSLEN); data/libtar-1.2.20/lib/encode.c:43:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(t->th_buf.magic, TMAGIC, TMAGLEN); data/libtar-1.2.20/lib/encode.c:84:15: [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 (pathname[strlen(pathname) - 1] != '/' && TH_ISDIR(t)) data/libtar-1.2.20/lib/encode.c:85:3: [1] (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 character. strcpy(suffix, "/"); data/libtar-1.2.20/lib/encode.c:87:6: [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(pathname) > T_NAMELEN-1 && (t->options & TAR_GNU)) data/libtar-1.2.20/lib/encode.c:91:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(t->th_buf.name, t->th_buf.gnu_longname, T_NAMELEN); data/libtar-1.2.20/lib/encode.c:93:11: [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 (strlen(pathname) > T_NAMELEN) data/libtar-1.2.20/lib/encode.c:96: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). tmp = strchr(&(pathname[strlen(pathname) - T_NAMELEN - 1]), '/'); data/libtar-1.2.20/lib/encode.c:125:6: [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(linkname) > T_NAMELEN-1 && (t->options & TAR_GNU)) data/libtar-1.2.20/lib/extract.c:135: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). pathname_len = strlen(th_get_pathname(t)) + 1; data/libtar-1.2.20/lib/extract.c:136: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). realname_len = strlen(realname) + 1; data/libtar-1.2.20/lib/extract.c:305: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). linktgt = &lnp[strlen(lnp) + 1]; data/libtar-1.2.20/lib/handle.c:30:48: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static tartype_t default_type = { open, close, read, write }; data/libtar-1.2.20/lib/libtar.h:178:30: [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). && ((t)->th_buf.name[strlen((t)->th_buf.name) - 1] == '/'))) data/libtar-1.2.20/lib/util.c:87:8: [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(path); data/libtar-1.2.20/lib/util.c:105:3: [1] (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 character. strcpy(dst, "/"); data/libtar-1.2.20/lib/util.c:113:4: [1] (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 character. strcat(dst, "/"); data/libtar-1.2.20/lib/wrapper.c:46:10: [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(prefix) + 1 + strlen(filename); data/libtar-1.2.20/lib/wrapper.c:46: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). len = strlen(prefix) + 1 + strlen(filename); data/libtar-1.2.20/lib/wrapper.c:53:10: [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(filename); data/libtar-1.2.20/lib/wrapper.c:93:10: [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(prefix) + 1 + strlen(filename); data/libtar-1.2.20/lib/wrapper.c:93: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). len = strlen(prefix) + 1 + strlen(filename); data/libtar-1.2.20/lib/wrapper.c:100:10: [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(filename); data/libtar-1.2.20/lib/wrapper.c:158: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). len = strlen(realdir) + 1 + strlen(dent->d_name); data/libtar-1.2.20/lib/wrapper.c:158: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). len = strlen(realdir) + 1 + strlen(dent->d_name); data/libtar-1.2.20/lib/wrapper.c:165:10: [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(savedir) + 1 + strlen(dent->d_name); data/libtar-1.2.20/lib/wrapper.c:165:32: [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(savedir) + 1 + strlen(dent->d_name); data/libtar-1.2.20/libtar/libtar.c:138:10: [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(rootdir) + 1 + strlen(pathname); data/libtar-1.2.20/libtar/libtar.c:138:32: [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(rootdir) + 1 + strlen(pathname); data/libtar-1.2.20/libtar/libtar.c:145:10: [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(pathname); ANALYSIS SUMMARY: Hits = 127 Lines analyzed = 5872 in approximately 0.17 seconds (35270 lines/second) Physical Source Lines of Code (SLOC) = 4095 Hits@level = [0] 109 [1] 57 [2] 44 [3] 10 [4] 12 [5] 4 Hits@level+ = [0+] 236 [1+] 127 [2+] 70 [3+] 26 [4+] 16 [5+] 4 Hits/KSLOC@level+ = [0+] 57.6313 [1+] 31.0134 [2+] 17.094 [3+] 6.34921 [4+] 3.9072 [5+] 0.976801 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.