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/hfsplus-1.0.4/libhfsp/src/FastUnicodeCompare.c Examining data/hfsplus-1.0.4/libhfsp/src/blockiter.c Examining data/hfsplus-1.0.4/libhfsp/src/btree.h Examining data/hfsplus-1.0.4/libhfsp/src/hfs.h Examining data/hfsplus-1.0.4/libhfsp/src/hfsp.h Examining data/hfsplus-1.0.4/libhfsp/src/hfstime.c Examining data/hfsplus-1.0.4/libhfsp/src/hfstime.h Examining data/hfsplus-1.0.4/libhfsp/src/libhfsp.c Examining data/hfsplus-1.0.4/libhfsp/src/os.h Examining data/hfsplus-1.0.4/libhfsp/src/partitions.h Examining data/hfsplus-1.0.4/libhfsp/src/record.h Examining data/hfsplus-1.0.4/libhfsp/src/unicode.h Examining data/hfsplus-1.0.4/libhfsp/src/volume.c Examining data/hfsplus-1.0.4/libhfsp/src/btree.c Examining data/hfsplus-1.0.4/libhfsp/src/apple.h Examining data/hfsplus-1.0.4/libhfsp/src/blockiter.h Examining data/hfsplus-1.0.4/libhfsp/src/volume.h Examining data/hfsplus-1.0.4/libhfsp/src/libhfsp.h Examining data/hfsplus-1.0.4/libhfsp/src/btreecheck.c Examining data/hfsplus-1.0.4/libhfsp/src/os.c Examining data/hfsplus-1.0.4/libhfsp/src/partitions.c Examining data/hfsplus-1.0.4/libhfsp/src/record.c Examining data/hfsplus-1.0.4/libhfsp/src/unicode.c Examining data/hfsplus-1.0.4/libhfsp/src/fscheck.c Examining data/hfsplus-1.0.4/libhfsp/src/swab.h Examining data/hfsplus-1.0.4/libhfsp/src/fscheck.h Examining data/hfsplus-1.0.4/libhfsp/test/test.c Examining data/hfsplus-1.0.4/mail/main.c Examining data/hfsplus-1.0.4/src/binhex.c Examining data/hfsplus-1.0.4/src/binhex.h Examining data/hfsplus-1.0.4/src/charset.c Examining data/hfsplus-1.0.4/src/charset.h Examining data/hfsplus-1.0.4/src/confdefs.h Examining data/hfsplus-1.0.4/src/copyout.h Examining data/hfsplus-1.0.4/src/crc.c Examining data/hfsplus-1.0.4/src/crc.h Examining data/hfsplus-1.0.4/src/darray.c Examining data/hfsplus-1.0.4/src/dlist.c Examining data/hfsplus-1.0.4/src/dstring.c Examining data/hfsplus-1.0.4/src/glob.h Examining data/hfsplus-1.0.4/src/hfsputil.c Examining data/hfsplus-1.0.4/src/hfsputil.h Examining data/hfsplus-1.0.4/src/hpcache.h Examining data/hfsplus-1.0.4/src/hpcd.c Examining data/hfsplus-1.0.4/src/hpcopy.c Examining data/hfsplus-1.0.4/src/hpfsck.c Examining data/hfsplus-1.0.4/src/hpmkdir.c Examining data/hfsplus-1.0.4/src/hpmount.c Examining data/hfsplus-1.0.4/src/hppwd.c Examining data/hfsplus-1.0.4/src/hprm.c Examining data/hfsplus-1.0.4/src/hpumount.c Examining data/hfsplus-1.0.4/src/glob.c Examining data/hfsplus-1.0.4/src/darray.h Examining data/hfsplus-1.0.4/src/dlist.h Examining data/hfsplus-1.0.4/src/dstring.h Examining data/hfsplus-1.0.4/src/copyout.c Examining data/hfsplus-1.0.4/src/hpcache.c Examining data/hfsplus-1.0.4/src/hpls.c FINAL RESULTS: data/hfsplus-1.0.4/libhfsp/src/fscheck.c:180:6: [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("\nInvalid total blocks %" PRIX32 ", expected %" PRIX32, data/hfsplus-1.0.4/src/charset.c:199:6: [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(ptr, subst); data/hfsplus-1.0.4/src/charset.c:279:6: [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(ptr, subst); data/hfsplus-1.0.4/src/copyout.c:483:2: [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(name, ext); data/hfsplus-1.0.4/src/copyout.c:515:6: [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(path, dstname); data/hfsplus-1.0.4/src/copyout.c:517:6: [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(path, hint); data/hfsplus-1.0.4/src/dlist.c:115: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(list->strs, str); data/hfsplus-1.0.4/src/hfsputil.c:362:7: [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, cwd); data/hfsplus-1.0.4/src/hfsputil.c:399: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(buf, path); data/hfsplus-1.0.4/src/hpcache.c:73: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(path, home); data/hfsplus-1.0.4/src/hpcache.c:74:2: [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(path, "/" CACHE_NAME); data/hfsplus-1.0.4/src/hpls.c:468:6: [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(timebuf, ctime(&when)); data/hfsplus-1.0.4/src/hpls.c:472:6: [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(timebuf + 11, timebuf + 19); data/hfsplus-1.0.4/src/hfsputil.c:355: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. cwd = getenv("PWD"); data/hfsplus-1.0.4/src/hpcache.c:66:12: [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. home = getenv("HOME"); data/hfsplus-1.0.4/src/hpcopy.c:302:8: [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. opt = getopt(argc, argv, "mbtra"); data/hfsplus-1.0.4/src/hpfsck.c:74:8: [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. opt = getopt(argc, argv, "vi"); data/hfsplus-1.0.4/src/hpls.c:954:13: [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. ptr = getenv("COLUMNS"); data/hfsplus-1.0.4/src/hpls.c:969:17: [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. int opt = getopt(argc, argv, "1abcdfilmqrstxw:CFNQRSU"); data/hfsplus-1.0.4/src/hpmkdir.c:130:8: [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. opt = getopt(argc, argv, "h"); data/hfsplus-1.0.4/src/hpmount.c:104:8: [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. opt = getopt(argc, argv, "hrp::"); data/hfsplus-1.0.4/src/hprm.c:128:8: [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. opt = getopt(argc, argv, "hRf"); data/hfsplus-1.0.4/libhfsp/src/apple.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 pmPartName[ 32]; /* partition name */ data/hfsplus-1.0.4/libhfsp/src/apple.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 pmPartType[ 32]; /* partition type */ data/hfsplus-1.0.4/libhfsp/src/apple.h:62: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 pmProcessor[ 16]; /* processor type */ data/hfsplus-1.0.4/libhfsp/src/btree.c:171: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[bt->vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/btree.c:183:2: [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(p, nodebuf, node_size); data/hfsplus-1.0.4/libhfsp/src/btree.c:270: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[bt->vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/btree.c:280:2: [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(&result->node, p , node_size); data/hfsplus-1.0.4/libhfsp/src/btree.c:367:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/btree.c:393: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 nodebuf[node_size]; data/hfsplus-1.0.4/libhfsp/src/btree.c:404:2: [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(bt->alloc_bits, p, alloc_size); data/hfsplus-1.0.4/libhfsp/src/btree.c:461: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[node_size]; data/hfsplus-1.0.4/libhfsp/src/btree.c:466:2: [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(p, bt->alloc_bits, alloc_size); data/hfsplus-1.0.4/libhfsp/src/btree.c:643:5: [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 (curr , key , len); // Copy the key / record data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:59:5: [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[255]; // mh this _might_ overflow data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:217:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/btreecheck.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 nodebuf[node_size]; data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:275:2: [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(bt->alloc_bits, p, alloc_size); data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:395:5: [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 kbuf[bt->head.max_key_len]; // dummy key to skip over data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:396:5: [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[bt->max_rec_size]; data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:512:5: [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 keybuf1[maxkeylen]; data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:513:5: [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 keybuf2[maxkeylen]; data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:626:5: [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[255]; // mh this _might_ overflow data/hfsplus-1.0.4/libhfsp/src/fscheck.c:234:5: [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(vh->finder_info, p, 32); data/hfsplus-1.0.4/libhfsp/src/fscheck.c:253:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/fscheck.c:264:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/hfsp.h:234:5: [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 data[0]; data/hfsplus-1.0.4/libhfsp/src/libhfsp.h:138:5: [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 node[0]; // size is actual node_size data/hfsplus-1.0.4/libhfsp/src/os.c:33:5: [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). int open(const char *, int, ...); data/hfsplus-1.0.4/libhfsp/src/os.c:95:8: [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(path, mode); data/hfsplus-1.0.4/libhfsp/src/os.c:195:28: [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. size_t size = read(fd, &((char *)buf)[ result], num- result); data/hfsplus-1.0.4/libhfsp/src/partitions.c:50: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, *source, length); data/hfsplus-1.0.4/libhfsp/src/partitions.c:105: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[ HFSP_BLOCKSZ]; data/hfsplus-1.0.4/libhfsp/src/partitions.c:130: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( map->parray, &first, sizeof( Partition)); data/hfsplus-1.0.4/libhfsp/src/record.c:770:5: [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 curr_key[tree->head.max_key_len]; data/hfsplus-1.0.4/libhfsp/src/record.c:845: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 curr_key[tree->head.max_key_len]; data/hfsplus-1.0.4/libhfsp/src/record.c:1243:5: [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[sizeof(record)]; // a bit too long, well data/hfsplus-1.0.4/libhfsp/src/volume.c:148:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/volume.c:177:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/volume.c:210:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/volume.c:348:5: [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(vh->finder_info, p, 32); data/hfsplus-1.0.4/libhfsp/src/volume.c:384:5: [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(p, vh->finder_info, 32); data/hfsplus-1.0.4/libhfsp/src/volume.c:397:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/volume.c:407:5: [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[vol->blksize]; data/hfsplus-1.0.4/libhfsp/src/volume.c:533: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[HFSP_BLOCKSZ]; data/hfsplus-1.0.4/libhfsp/src/volume.c:566: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[HFSP_BLOCKSZ]; data/hfsplus-1.0.4/mail/main.c:19:5: [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 s [64]; data/hfsplus-1.0.4/src/binhex.c:52: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. static char line[67]; /* ASCII line buffer */ data/hfsplus-1.0.4/src/binhex.c:60: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 zero[2] = { 0, 0 }; data/hfsplus-1.0.4/src/binhex.c:70: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. signed char demap[256] = { data/hfsplus-1.0.4/src/binhex.c:296: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 word[2]; data/hfsplus-1.0.4/src/binhex.c:562: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 word[2]; data/hfsplus-1.0.4/src/charset.c:83: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 *macroman_subst[128] = { data/hfsplus-1.0.4/src/charset.c:107: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 latin1[256]; data/hfsplus-1.0.4/src/charset.c:111: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 *latin1_subst[128] = { data/hfsplus-1.0.4/src/copyout.c:34:5: [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). int open(const char *, int, ...); data/hfsplus-1.0.4/src/copyout.c:83:5: [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[blksize]; /* this is a gcc feature */ data/hfsplus-1.0.4/src/copyout.c:117: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[MACB_BLOCKSZ] = { 0 }; data/hfsplus-1.0.4/src/copyout.c:139: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[MACB_BLOCKSZ] = { 0 }; data/hfsplus-1.0.4/src/copyout.c:222:5: [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[blksize]; /* this is a gcc feature */ data/hfsplus-1.0.4/src/copyout.c:268: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 name[255]; data/hfsplus-1.0.4/src/copyout.c:359:5: [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[blksize]; /* this is a gcc feature */ data/hfsplus-1.0.4/src/copyout.c:421:5: [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[blksize]; /* this is a gcc feature */ data/hfsplus-1.0.4/src/copyout.c:466:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char name[255 + 4 + 1]; // Not multihtreaded, well data/hfsplus-1.0.4/src/copyout.c:523: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(dstname, O_WRONLY | O_CREAT | O_TRUNC, 0666); data/hfsplus-1.0.4/src/darray.c:104:5: [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(eltend, elem, elemsz); data/hfsplus-1.0.4/src/dlist.c:104:2: [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(newlist.strs, list->strs, strsz); data/hfsplus-1.0.4/src/dstring.c:109:2: [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, string->str, string->len); data/hfsplus-1.0.4/src/dstring.c:119:5: [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(string->str + string->len, str, len); data/hfsplus-1.0.4/src/dstring.h:31:5: [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 sbuf[50]; data/hfsplus-1.0.4/src/glob.c:225: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[255]; data/hfsplus-1.0.4/src/hpcache.c:50:5: [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 vname[255]; /* name of the original opened device. */ data/hfsplus-1.0.4/src/hpcache.c:87:7: [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). fd = fopen(path, mode); data/hfsplus-1.0.4/src/hpls.c:308:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf, "\\%03o", c); data/hfsplus-1.0.4/src/hpls.c:338:6: [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[5]; data/hfsplus-1.0.4/src/hpls.c:347: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(buf, "%c", *ptr); data/hfsplus-1.0.4/src/hpls.c:442: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[26]; data/hfsplus-1.0.4/src/hpls.c:783:6: [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[255]; data/hfsplus-1.0.4/src/hpls.c:955:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). width = ptr ? atoi(ptr) : 80; data/hfsplus-1.0.4/src/hpls.c:1043:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). width = atoi(optarg); data/hfsplus-1.0.4/src/hppwd.c:47:5: [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[255]; data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:667: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 (name->strlen > 255) data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:669:44: [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). printf("strlen in name %d > 255\n", name->strlen); data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:687: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 (key->key_length != ((name->strlen << 1) + 6)) data/hfsplus-1.0.4/libhfsp/src/btreecheck.c:690: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). key->key_length, name->strlen); data/hfsplus-1.0.4/libhfsp/src/hfsp.h:227:13: [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). UInt16 strlen; data/hfsplus-1.0.4/libhfsp/src/os.c:42:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t read(int, void *, size_t); data/hfsplus-1.0.4/libhfsp/src/os.c:86:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getchar(); data/hfsplus-1.0.4/libhfsp/src/os.c:195:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t size = read(fd, &((char *)buf)[ result], num- result); data/hfsplus-1.0.4/libhfsp/src/record.c:91:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = key->name.strlen; data/hfsplus-1.0.4/libhfsp/src/record.c:501:45: [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). bstoreU16_inc(p, len = entry->nodeName.strlen); data/hfsplus-1.0.4/libhfsp/src/record.c:979:63: [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). parentKey.key_length = 6 + r->record.u.thread.nodeName.strlen * 2; data/hfsplus-1.0.4/libhfsp/src/record.c:1215:64: [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). folderKey.key_length = 6 + r->record.u.thread.nodeName.strlen * 2; data/hfsplus-1.0.4/libhfsp/src/unicode.c:63:29: [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 strlen = ustr->strlen; data/hfsplus-1.0.4/libhfsp/src/unicode.c:71:13: [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). while ((strlen > 0) && (maxlen > 0)) data/hfsplus-1.0.4/libhfsp/src/unicode.c:102:38: [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). register UInt16 length1 = ustr1->strlen; data/hfsplus-1.0.4/libhfsp/src/unicode.c:103:38: [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). register UInt16 length2 = ustr2->strlen; data/hfsplus-1.0.4/src/binhex.c:378:6: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/hfsplus-1.0.4/src/binhex.c:399:6: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/hfsplus-1.0.4/src/binhex.c:414:6: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/hfsplus-1.0.4/src/binhex.c:446:6: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/hfsplus-1.0.4/src/binhex.c:594:6: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/hfsplus-1.0.4/src/binhex.c:602:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file); data/hfsplus-1.0.4/src/charset.c:144: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). len = lenptr ? *lenptr : strlen(mstr); data/hfsplus-1.0.4/src/charset.c:170: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). ilen = lenptr ? *lenptr : strlen(mstr); data/hfsplus-1.0.4/src/charset.c:179: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). olen += strlen(macroman_subst[ch & 0x7f]); data/hfsplus-1.0.4/src/charset.c:200:13: [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). ptr += strlen(subst); data/hfsplus-1.0.4/src/charset.c:249: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). ilen = lenptr ? *lenptr : strlen(lstr); data/hfsplus-1.0.4/src/charset.c:258: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). olen += strlen(latin1_subst[ch & 0x7f]); data/hfsplus-1.0.4/src/charset.c:280:13: [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). ptr += strlen(subst); data/hfsplus-1.0.4/src/copyout.c:508: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). path = malloc(strlen(dstname) + 1 + strlen(hint) + 1); data/hfsplus-1.0.4/src/copyout.c:508:42: [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). path = malloc(strlen(dstname) + 1 + strlen(hint) + 1); data/hfsplus-1.0.4/src/copyout.c:516:6: [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(path, "/"); data/hfsplus-1.0.4/src/dlist.c:86: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(str) + 1; data/hfsplus-1.0.4/src/dstring.c:66:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sbuf, from->str, space); data/hfsplus-1.0.4/src/dstring.c:74:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sbuf, from->str, space); data/hfsplus-1.0.4/src/dstring.c:91: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(str); data/hfsplus-1.0.4/src/hfsputil.c:358: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). buf = malloc(strlen(cwd) + 1 + strlen(path) + 1); data/hfsplus-1.0.4/src/hfsputil.c:358:38: [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). buf = malloc(strlen(cwd) + 1 + strlen(path) + 1); data/hfsplus-1.0.4/src/hfsputil.c:390:26: [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). buf = realloc(cwd, strlen(cwd) + 1 + strlen(path) + 1); data/hfsplus-1.0.4/src/hfsputil.c:390:44: [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). buf = realloc(cwd, strlen(cwd) + 1 + strlen(path) + 1); data/hfsplus-1.0.4/src/hfsputil.c:398:3: [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(buf, "/"); data/hfsplus-1.0.4/src/hpcache.c:70: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). path = malloc(strlen(home) + 1 + sizeof(CACHE_NAME)); data/hfsplus-1.0.4/src/hpcache.c:153:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(volume_cache.vname, devicename, 255); data/hfsplus-1.0.4/src/hpls.c:352:5: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf, "?"); data/hfsplus-1.0.4/src/hpls.c:535:13: [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(strs[i]) + misc; data/hfsplus-1.0.4/src/hpls.c:561: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). for (len = strlen(strs[i - rows]) + misc; data/hfsplus-1.0.4/src/hpls.c:584:13: [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(strs[i]) + misc; data/hfsplus-1.0.4/src/hpls.c:603: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). for (len = strlen(strs[i - 1]) + misc; data/hfsplus-1.0.4/src/hpls.c:630: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). int len = strlen(strs[i]) + misclen(flags) + ((i < sz - 1) ? 2 : 0); ANALYSIS SUMMARY: Hits = 151 Lines analyzed = 13202 in approximately 0.47 seconds (28285 lines/second) Physical Source Lines of Code (SLOC) = 8123 Hits@level = [0] 252 [1] 49 [2] 80 [3] 9 [4] 13 [5] 0 Hits@level+ = [0+] 403 [1+] 151 [2+] 102 [3+] 22 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 49.6122 [1+] 18.5892 [2+] 12.5569 [3+] 2.70836 [4+] 1.60039 [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.