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/unace-1.2b/globals.c Examining data/unace-1.2b/uac_comm.c Examining data/unace-1.2b/uac_crc.c Examining data/unace-1.2b/uac_sys.c Examining data/unace-1.2b/acestruc.h Examining data/unace-1.2b/globals.h Examining data/unace-1.2b/os.h Examining data/unace-1.2b/uac_comm.h Examining data/unace-1.2b/portable.h Examining data/unace-1.2b/uac_crc.h Examining data/unace-1.2b/uac_dcpr.h Examining data/unace-1.2b/uac_sys.h Examining data/unace-1.2b/unace.h Examining data/unace-1.2b/uac_dcpr.c Examining data/unace-1.2b/uac_crt.c Examining data/unace-1.2b/uac_crt.h Examining data/unace-1.2b/declare.h Examining data/unace-1.2b/unace.c FINAL RESULTS: data/unace-1.2b/unace.c:337:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(s, "Ready to process %s?", aname); data/unace-1.2b/unace.c:416:7: [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(crc_not_ok ? " CRC-check error" : " CRC OK"); data/unace-1.2b/unace.h:64:28: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. #define fileexists(name) (!access(name, 0)) data/unace-1.2b/uac_crt.c:193: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 ((han = open(file, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, data/unace-1.2b/uac_dcpr.c:145: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(buf_rd, comm, i); data/unace-1.2b/uac_dcpr.c:311:4: [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(&sort_freq, wd, (size1_t + 1) * sizeof(CHAR)); data/unace-1.2b/uac_dcpr.c:428: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(buf, &dcpr_text[old_pos], i); data/unace-1.2b/uac_dcpr.c:429: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(&buf[i], dcpr_text, dcpr_do - i); data/unace-1.2b/uac_dcpr.c:432: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(buf, &dcpr_text[old_pos], dcpr_do); data/unace-1.2b/uac_dcpr.c:450: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(&buf[pos], buf_rd, i); data/unace-1.2b/unace.c:173:10: [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(mhead.ACESIGN, tp, acesign_len); tp+=acesign_len; data/unace-1.2b/unace.c:186:10: [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(mhead.AV, tp, mhead.AV_SIZE); data/unace-1.2b/unace.c:205:10: [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(fhead.FNAME, tp, fhead.FNAME_SIZE); data/unace-1.2b/unace.c:257: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(buf, &buf[size_buf - 512], 512); data/unace-1.2b/unace.c:268: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). archan = open(aname, O_RDONLY | O_BINARY); // open file data/unace-1.2b/unace.c:287:7: [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(av_str, "\ncreated on %d.%d.%d by ", data/unace-1.2b/unace.c:483:19: [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 Date[9], Time[9]; data/unace-1.2b/unace.c:486:19: [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(Date, "%02d-%02d-%02d", ts_year(tstamp)-1900, ts_month(tstamp), ts_day(tstamp)); data/unace-1.2b/unace.c:487:19: [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(Time, "%02d:%02d:%02d", ts_hour(tstamp), ts_min(tstamp), ts_sec(tstamp)); data/unace-1.2b/unace.c:623:10: [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(aname, ".ACE"); data/unace-1.2b/uac_crt.c:46:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, (*(tfhead *) head).FNAME, i); data/unace-1.2b/uac_crt.c:53: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). memmove(s, cp+1, strlen(cp)); data/unace-1.2b/uac_crt.c:67:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(s, cp, strlen(cp) + 1); data/unace-1.2b/uac_crt.c:126:36: [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 ((cp = (CHAR *) strchr(&f[strlen(d) + 1], DIRSEP))!=NULL) data/unace-1.2b/uac_crt.c:131:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(d, f, i); data/unace-1.2b/uac_sys.h:21:19: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define getch() getchar() data/unace-1.2b/unace.c:63: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(name); data/unace-1.2b/unace.c:123:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(archan, &head, 4)<4) data/unace-1.2b/unace.c:136:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(archan, readbuf, rd) < rd) data/unace-1.2b/unace.c:144:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(archan, buf, rd) < rd) data/unace-1.2b/unace.c:233:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fpos += read(archan, &buf[buf_pos], size_buf - buf_pos); data/unace-1.2b/unace.c:293:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(av_str, mhead.AV, copylen); data/unace-1.2b/unace.c:389:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rd += read(archan, buffer, i); data/unace-1.2b/unace.c:593: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). if (argc < 3 || strlen(argv[1]) > 1 || argv[argc-1][0] == '-') data/unace-1.2b/unace.c:618:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(aname, argv[arg_cnt], sizeof(aname) - 4); // get archive name ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 2325 in approximately 0.06 seconds (38822 lines/second) Physical Source Lines of Code (SLOC) = 1762 Hits@level = [0] 34 [1] 15 [2] 17 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 69 [1+] 35 [2+] 20 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 39.16 [1+] 19.8638 [2+] 11.3507 [3+] 1.70261 [4+] 1.70261 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.