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/cabextract-1.9/mspack/mszip.h Examining data/cabextract-1.9/mspack/qtmd.c Examining data/cabextract-1.9/mspack/system.h Examining data/cabextract-1.9/mspack/cab.h Examining data/cabextract-1.9/mspack/lzx.h Examining data/cabextract-1.9/mspack/readbits.h Examining data/cabextract-1.9/mspack/system.c Examining data/cabextract-1.9/mspack/qtm.h Examining data/cabextract-1.9/mspack/mspack.h Examining data/cabextract-1.9/mspack/mszipd.c Examining data/cabextract-1.9/mspack/readhuff.h Examining data/cabextract-1.9/mspack/lzxd.c Examining data/cabextract-1.9/mspack/cabd.c Examining data/cabextract-1.9/getopt.h Examining data/cabextract-1.9/md5.h Examining data/cabextract-1.9/fnmatch_.h Examining data/cabextract-1.9/getopt.c Examining data/cabextract-1.9/md5.c Examining data/cabextract-1.9/getopt1.c Examining data/cabextract-1.9/src/cabextract.c Examining data/cabextract-1.9/src/cabinfo.c Examining data/cabextract-1.9/fnmatch.c FINAL RESULTS: data/cabextract-1.9/src/cabextract.c:919:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(filename, mode & ~user_umask); data/cabextract-1.9/mspack/cab.h:89:25: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *system; data/cabextract-1.9/mspack/cab.h:115:25: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *system; data/cabextract-1.9/mspack/cabd.c:175:39: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *sys = self->system; data/cabextract-1.9/mspack/cabd.c:201:15: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. sys = self->system; data/cabextract-1.9/mspack/cabd.c:240:15: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. sys = self->system; data/cabextract-1.9/mspack/cabd.c:600:15: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. sys = self->system; data/cabextract-1.9/mspack/cabd.c:649:37: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *sys = self->system; data/cabextract-1.9/mspack/cabd.c:824:15: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. sys = self->system; data/cabextract-1.9/mspack/cabd.c:1020:15: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. sys = self->system; data/cabextract-1.9/mspack/cabd.c:1221:37: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *sys = self->system; data/cabextract-1.9/mspack/lzx.h:147:60: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. extern struct lzxd_stream *lzxd_init(struct mspack_system *system, data/cabextract-1.9/mspack/lzx.h:176:58: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *system, data/cabextract-1.9/mspack/lzxd.c:279:53: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct lzxd_stream *lzxd_init(struct mspack_system *system, data/cabextract-1.9/mspack/lzxd.c:291:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!system) return NULL; data/cabextract-1.9/mspack/lzxd.c:313:52: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!(lzx = (struct lzxd_stream *) system->alloc(system, sizeof(struct lzxd_stream)))) { data/cabextract-1.9/mspack/lzxd.c:318:49: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. lzx->window = (unsigned char *) system->alloc(system, (size_t) window_size); data/cabextract-1.9/mspack/lzxd.c:319:49: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. lzx->inbuf = (unsigned char *) system->alloc(system, (size_t) input_buffer_size); data/cabextract-1.9/mspack/lzxd.c:328:26: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. lzx->sys = system; data/cabextract-1.9/mspack/lzxd.c:355:51: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mspack_system *system, data/cabextract-1.9/mspack/lzxd.c:373:25: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (length > 0 && (!system || !input)) { data/cabextract-1.9/mspack/mszip.h:85:64: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. extern struct mszipd_stream *mszipd_init(struct mspack_system *system, data/cabextract-1.9/mspack/mszipd.c:342:57: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct mszipd_stream *mszipd_init(struct mspack_system *system, data/cabextract-1.9/mspack/mszipd.c:350:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!system) return NULL; data/cabextract-1.9/mspack/mszipd.c:357:54: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!(zip = (struct mszipd_stream *) system->alloc(system, sizeof(struct mszipd_stream)))) { data/cabextract-1.9/mspack/mszipd.c:362:49: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. zip->inbuf = (unsigned char *) system->alloc(system, (size_t) input_buffer_size); data/cabextract-1.9/mspack/mszipd.c:369:26: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. zip->sys = system; data/cabextract-1.9/mspack/qtm.h:92:60: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. extern struct qtmd_stream *qtmd_init(struct mspack_system *system, data/cabextract-1.9/mspack/qtmd.c:186:53: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. struct qtmd_stream *qtmd_init(struct mspack_system *system, data/cabextract-1.9/mspack/qtmd.c:195:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!system) return NULL; data/cabextract-1.9/mspack/qtmd.c:205:52: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!(qtm = (struct qtmd_stream *) system->alloc(system, sizeof(struct qtmd_stream)))) { data/cabextract-1.9/mspack/qtmd.c:210:49: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. qtm->window = (unsigned char *) system->alloc(system, (size_t) window_size); data/cabextract-1.9/mspack/qtmd.c:211:49: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. qtm->inbuf = (unsigned char *) system->alloc(system, (size_t) input_buffer_size); data/cabextract-1.9/mspack/qtmd.c:220:22: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. qtm->sys = system; data/cabextract-1.9/mspack/system.c:68:46: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. int mspack_sys_filelen(struct mspack_system *system, data/cabextract-1.9/mspack/system.c:73:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (!system || !file || !length) return MSPACK_ERR_OPEN; data/cabextract-1.9/mspack/system.c:197: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, ap); data/cabextract-1.9/mspack/system.h:48:20: [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 x ; fputc('\n', stdout); fflush(stdout);} while (0); data/cabextract-1.9/mspack/system.h:103:53: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. extern int mspack_sys_filelen(struct mspack_system *system, data/cabextract-1.9/src/cabextract.c:619: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(&cab[len], cabname); data/cabextract-1.9/src/cabextract.c:629:11: [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(cab, entry->d_name); data/cabextract-1.9/src/cabextract.c:758:5: [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(name, dir); data/cabextract-1.9/src/cabextract.c:1015:17: [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). if (fm->from) strcpy(fm->from, from); data/cabextract-1.9/src/cabextract.c:1246: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, ap); data/cabextract-1.9/getopt.c:209:9: [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. #ifndef getenv data/cabextract-1.9/getopt.c:210:14: [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. extern char *getenv (); data/cabextract-1.9/getopt.c:403:21: [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. posixly_correct = getenv ("POSIXLY_CORRECT"); data/cabextract-1.9/getopt.c:973:1: [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. getopt (argc, argv, optstring) data/cabextract-1.9/getopt.h:134:12: [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. extern int getopt (int __argc, char *const *__argv, const char *__shortopts); data/cabextract-1.9/getopt.h:136:12: [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. extern int getopt (); data/cabextract-1.9/getopt.h:140:12: [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. extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, data/cabextract-1.9/getopt.h:153:12: [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. extern int getopt (); data/cabextract-1.9/getopt.h:155:12: [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. extern int getopt_long (); data/cabextract-1.9/getopt1.c:63:1: [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. getopt_long (argc, argv, options, long_options, opt_index) data/cabextract-1.9/src/cabextract.c:222:15: [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. while ((i = getopt_long(argc, argv, OPTSTRING, optlist, NULL)) != -1) { data/cabextract-1.9/getopt.c:330:11: [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_str, __getopt_nonoption_flags, data/cabextract-1.9/getopt.c:442:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (__getopt_nonoption_flags, orig_str, len); data/cabextract-1.9/md5.c:65:23: [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 const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; data/cabextract-1.9/md5.c:116: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 (&ctx->buffer[bytes], fillbuf, pad); data/cabextract-1.9/md5.c:136: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 buffer[BLOCKSIZE + 72]; data/cabextract-1.9/md5.c:225: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->buffer[left_over], buffer, add); data/cabextract-1.9/md5.c:234:11: [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->buffer, &ctx->buffer[(left_over + add) & ~63], data/cabextract-1.9/md5.c:256:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ctx->buffer, buffer, 64); data/cabextract-1.9/md5.c:275: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->buffer[left_over], buffer, len); data/cabextract-1.9/md5.c:281:11: [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->buffer, &ctx->buffer[64], left_over); data/cabextract-1.9/md5.h:95: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 buffer[128]; data/cabextract-1.9/mspack/cab.h:109: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. unsigned char input[CAB_INPUTBUF]; /* one input block of data */ data/cabextract-1.9/mspack/cabd.c:203:18: [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 ((fh = sys->open(sys, filename, MSPACK_SYS_OPEN_READ))) { data/cabextract-1.9/mspack/cabd.c:316: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. unsigned char buf[64]; data/cabextract-1.9/mspack/cabd.c:541: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[256], *str; data/cabextract-1.9/mspack/cabd.c:610:18: [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 ((fh = sys->open(sys, filename, MSPACK_SYS_OPEN_READ))) { data/cabextract-1.9/mspack/cabd.c:1086:28: [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). self->d->infh = sys->open(sys, fol->data.cab->base.filename, data/cabextract-1.9/mspack/cabd.c:1113:19: [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 (!(fh = sys->open(sys, filename, MSPACK_SYS_OPEN_WRITE))) { data/cabextract-1.9/mspack/cabd.c:1302: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. unsigned char hdr[cfdata_SIZEOF]; data/cabextract-1.9/mspack/cabd.c:1381:26: [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 (!(d->infh = sys->open(sys, d->incab->base.filename, data/cabextract-1.9/mspack/lzx.h:85: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. unsigned char PRETREE_len [LZX_PRETREE_MAXSYMBOLS + LZX_LENTABLE_SAFETY]; data/cabextract-1.9/mspack/lzx.h:86: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. unsigned char MAINTREE_len [LZX_MAINTREE_MAXSYMBOLS + LZX_LENTABLE_SAFETY]; data/cabextract-1.9/mspack/lzx.h:87: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. unsigned char LENGTH_len [LZX_LENGTH_MAXSYMBOLS + LZX_LENTABLE_SAFETY]; data/cabextract-1.9/mspack/lzx.h:88: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. unsigned char ALIGNED_len [LZX_ALIGNED_MAXSYMBOLS + LZX_LENTABLE_SAFETY]; data/cabextract-1.9/mspack/lzx.h:102: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. unsigned char e8_buf[LZX_FRAME_SIZE]; data/cabextract-1.9/mspack/lzxd.c:217:23: [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 const unsigned char extra_bits[36] = { data/cabextract-1.9/mspack/lzxd.c:403: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. unsigned char *window, *runsrc, *rundest, buf[12]; data/cabextract-1.9/mspack/mspack.h:310:26: [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). struct mspack_file * (*open)(struct mspack_system *self, data/cabextract-1.9/mspack/mspack.h:978:29: [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). struct mscabd_cabinet * (*open) (struct mscab_decompressor *self, data/cabextract-1.9/mspack/mspack.h:1598:27: [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). struct mschmd_header *(*open)(struct mschm_decompressor *self, data/cabextract-1.9/mspack/mspack.h:1896:28: [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). struct msszddd_header *(*open)(struct msszdd_decompressor *self, data/cabextract-1.9/mspack/mspack.h:2176:28: [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). struct mskwajd_header *(*open)(struct mskwaj_decompressor *self, data/cabextract-1.9/mspack/mszip.h:62: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. unsigned char LITERAL_len[MSZIP_LITERAL_MAXSYMBOLS]; data/cabextract-1.9/mspack/mszip.h:63: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. unsigned char DISTANCE_len[MSZIP_DISTANCE_MAXSYMBOLS]; data/cabextract-1.9/mspack/mszip.h:70: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. unsigned char window[MSZIP_FRAME_SIZE]; data/cabextract-1.9/mspack/mszipd.c:59:23: [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 const unsigned char lit_extrabits[29] = { data/cabextract-1.9/mspack/mszipd.c:65:23: [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 const unsigned char dist_extrabits[30] = { data/cabextract-1.9/mspack/mszipd.c:71:23: [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 const unsigned char bitlen_order[19] = { data/cabextract-1.9/mspack/mszipd.c:99: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. unsigned char bl_len[19]; data/cabextract-1.9/mspack/mszipd.c:101: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. unsigned char lens[MSZIP_LITERAL_MAXSYMBOLS + MSZIP_DISTANCE_MAXSYMBOLS]; data/cabextract-1.9/mspack/mszipd.c:177:16: [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. unsigned char lens_buf[4]; data/cabextract-1.9/mspack/qtmd.c:71:23: [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 const unsigned char extra_bits[42] = { data/cabextract-1.9/mspack/qtmd.c:75:23: [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 const unsigned char length_base[27] = { data/cabextract-1.9/mspack/qtmd.c:79:23: [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 const unsigned char length_extra[27] = { data/cabextract-1.9/mspack/system.c:61:33: [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). return (sys != NULL) && (sys->open != NULL) && (sys->close != NULL) && data/cabextract-1.9/mspack/system.c:134: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). if ((fh->fh = fopen(filename, fmode))) return (struct mspack_file *) fh; data/cabextract-1.9/mspack/system.c:232: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(dest, src, bytes); data/cabextract-1.9/mspack/system.h:84:37: [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. #define __egi32(a,n) ( ((((unsigned char *) a)[n+3]) << 24) | \ data/cabextract-1.9/mspack/system.h:85:37: [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. ((((unsigned char *) a)[n+2]) << 16) | \ data/cabextract-1.9/mspack/system.h:86:37: [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. ((((unsigned char *) a)[n+1]) << 8) | \ data/cabextract-1.9/mspack/system.h:87:37: [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. ((((unsigned char *) a)[n+0]))) data/cabextract-1.9/mspack/system.h:94:36: [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. #define EndGetM32(a) (((((unsigned char *) a)[0]) << 24) | \ data/cabextract-1.9/mspack/system.h:95:36: [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. ((((unsigned char *) a)[1]) << 16) | \ data/cabextract-1.9/mspack/system.h:96:36: [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. ((((unsigned char *) a)[2]) << 8) | \ data/cabextract-1.9/mspack/system.h:97:36: [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. ((((unsigned char *) a)[3]))) data/cabextract-1.9/src/cabextract.c:155: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. unsigned char md5_result[16]; data/cabextract-1.9/src/cabextract.c:555:24: [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 (!(cab2 = cabd->open(cabd,name)) || cabd->prepend(cabd, cab, cab2)) { data/cabextract-1.9/src/cabextract.c:575:24: [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 (!(cab2 = cabd->open(cabd,name)) || cabd->append(cabd, cab, cab2)) { data/cabextract-1.9/src/cabextract.c:614:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (tail) memcpy(cab, origcab, (size_t) len); data/cabextract-1.9/src/cabextract.c:1165:21: [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 ((fh->fh = fopen(filename, fmode))) { data/cabextract-1.9/src/cabextract.c:1258: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(dest, src, bytes); data/cabextract-1.9/src/cabinfo.c:61: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). if ((fh = fopen((filename = argv[i]), "rb"))) { data/cabextract-1.9/src/cabinfo.c:83: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. unsigned char search_buf[SEARCH_SIZE]; data/cabextract-1.9/src/cabinfo.c:172:14: [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. unsigned char buf[64]; data/cabextract-1.9/src/cabinfo.c:325: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 namebuf[CAB_NAMEMAX]; data/cabextract-1.9/getopt.c:232: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). # if (!defined __STDC__ || !__STDC__) && !defined strlen data/cabextract-1.9/getopt.c:235: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). extern int strlen (const char *); data/cabextract-1.9/getopt.c:434: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). int len = nonoption_flags_max_len = strlen (orig_str); data/cabextract-1.9/getopt.c:661:35: [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). == (unsigned int) strlen (p->name)) data/cabextract-1.9/getopt.c:685: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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:717: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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:733: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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:738: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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:849:58: [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 ((unsigned int) (nameend - nextchar) == strlen (p->name)) data/cabextract-1.9/getopt.c:872: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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:891:33: [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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:905:33: [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). nextchar += strlen (nextchar); data/cabextract-1.9/getopt.c:909: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). nextchar += strlen (nextchar); data/cabextract-1.9/mspack/cabd.c:334:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(fh, &buf[0], cfhead_SIZEOF) != cfhead_SIZEOF) { data/cabextract-1.9/mspack/cabd.c:371:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(fh, &buf[0], cfheadext_SIZEOF) != cfheadext_SIZEOF) { data/cabextract-1.9/mspack/cabd.c:413:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(fh, &buf[0], cffold_SIZEOF) != cffold_SIZEOF) { data/cabextract-1.9/mspack/cabd.c:443:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(fh, &buf[0], cffile_SIZEOF) != cffile_SIZEOF) { data/cabextract-1.9/mspack/cabd.c:545:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = sys->read(fh, &buf[0], 256)) <= 0) { data/cabextract-1.9/mspack/cabd.c:672:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(fh, &buf[0], (int) length) != (int) length) { data/cabextract-1.9/mspack/cabd.c:1311:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(d->infh, &hdr[0], cfdata_SIZEOF) != cfdata_SIZEOF) { data/cabextract-1.9/mspack/cabd.c:1341:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (sys->read(d->infh, d->i_end, len) != len) { data/cabextract-1.9/mspack/cabd.c:1455:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (s->sys->read(s->i, &s->buf[0], run) != run) return MSPACK_ERR_READ; data/cabextract-1.9/mspack/lzxd.c:382:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int bytes = system->read(input, pos, length); data/cabextract-1.9/mspack/mspack.h:336:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int (*read)(struct mspack_file *file, data/cabextract-1.9/mspack/readbits.h:184:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read = p->sys->read(p->input, &p->inbuf[0], (int)p->inbuf_size); data/cabextract-1.9/mspack/readbits.h:185:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read < 0) return p->error = MSPACK_ERR_READ; data/cabextract-1.9/mspack/readbits.h:203:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). p->i_end = &p->inbuf[read]; data/cabextract-1.9/mspack/system.c:62:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (sys->read != NULL) && (sys->write != NULL) && (sys->seek != NULL) && data/cabextract-1.9/mspack/system.h:30:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #ifdef read data/cabextract-1.9/mspack/system.h:31:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # undef read data/cabextract-1.9/src/cabextract.c:318:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(user_umask = umask(0)); data/cabextract-1.9/src/cabextract.c:318:22: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(user_umask = umask(0)); data/cabextract-1.9/src/cabextract.c:437: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). fname_offset = args.dir ? (strlen(args.dir) + 1) : 0; data/cabextract-1.9/src/cabextract.c:476: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). int spaces = 79 - (strlen(name) + 8 + 32); data/cabextract-1.9/src/cabextract.c:611:41: [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 (!(cab = malloc((tail ? len : 2) + strlen(cabname) + 1))) return NULL; data/cabextract-1.9/src/cabextract.c:741: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). size_t dirlen = dir ? strlen(dir) + 1 : 0; /* length of dir + '/' */ data/cabextract-1.9/src/cabextract.c:742: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). size_t filelen = strlen(fname); data/cabextract-1.9/src/cabextract.c:858: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). size_t len = strlen((char *) i); data/cabextract-1.9/src/cabextract.c:864:7: [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((char *) o, "x"); data/cabextract-1.9/src/cabextract.c:925: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). size_t ilen = strlen(name) + 1, olen = ilen * 4; data/cabextract-1.9/src/cabextract.c:1014: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). fm->from = (from) ? malloc(strlen(from)+1) : NULL; ANALYSIS SUMMARY: Hits = 161 Lines analyzed = 10879 in approximately 0.38 seconds (28451 lines/second) Physical Source Lines of Code (SLOC) = 5800 Hits@level = [0] 91 [1] 41 [2] 65 [3] 11 [4] 43 [5] 1 Hits@level+ = [0+] 252 [1+] 161 [2+] 120 [3+] 55 [4+] 44 [5+] 1 Hits/KSLOC@level+ = [0+] 43.4483 [1+] 27.7586 [2+] 20.6897 [3+] 9.48276 [4+] 7.58621 [5+] 0.172414 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.