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/libhx-3.25/assorted/deque2.c Examining data/libhx-3.25/assorted/pack.c Examining data/libhx-3.25/assorted/tofrac.c Examining data/libhx-3.25/assorted/unit2any.c Examining data/libhx-3.25/doc/const_cast.c Examining data/libhx-3.25/doc/generator.cpp Examining data/libhx-3.25/doc/slurp.c Examining data/libhx-3.25/include/libHX.h Examining data/libhx-3.25/include/libHX/ctype_helper.h Examining data/libhx-3.25/include/libHX/defs.h Examining data/libhx-3.25/include/libHX/deque.h Examining data/libhx-3.25/include/libHX/init.h Examining data/libhx-3.25/include/libHX/io.h Examining data/libhx-3.25/include/libHX/libxml_helper.h Examining data/libhx-3.25/include/libHX/list.h Examining data/libhx-3.25/include/libHX/map.h Examining data/libhx-3.25/include/libHX/misc.h Examining data/libhx-3.25/include/libHX/option.h Examining data/libhx-3.25/include/libHX/proc.h Examining data/libhx-3.25/include/libHX/string.h Examining data/libhx-3.25/include/libHX/wx_helper.hpp Examining data/libhx-3.25/src/deque.c Examining data/libhx-3.25/src/dl.c Examining data/libhx-3.25/src/format.c Examining data/libhx-3.25/src/internal.h Examining data/libhx-3.25/src/map.c Examining data/libhx-3.25/src/map_int.h Examining data/libhx-3.25/src/mc.c Examining data/libhx-3.25/src/misc.c Examining data/libhx-3.25/src/opt.c Examining data/libhx-3.25/src/proc.c Examining data/libhx-3.25/src/rand.c Examining data/libhx-3.25/src/rtcheck.c Examining data/libhx-3.25/src/string.c Examining data/libhx-3.25/src/tc-cast.c Examining data/libhx-3.25/src/tc-compile.c Examining data/libhx-3.25/src/tc-deque.c Examining data/libhx-3.25/src/tc-dir.c Examining data/libhx-3.25/src/tc-format.c Examining data/libhx-3.25/src/tc-link.c Examining data/libhx-3.25/src/tc-list.c Examining data/libhx-3.25/src/tc-list2.c Examining data/libhx-3.25/src/tc-map.c Examining data/libhx-3.25/src/tc-memmem.c Examining data/libhx-3.25/src/tc-misc.c Examining data/libhx-3.25/src/tc-netio.c Examining data/libhx-3.25/src/tc-option.c Examining data/libhx-3.25/src/tc-proc.c Examining data/libhx-3.25/src/tc-rand.c Examining data/libhx-3.25/src/tc-realpath.c Examining data/libhx-3.25/src/tc-shconfig.c Examining data/libhx-3.25/src/tc-strchr2.c Examining data/libhx-3.25/src/tc-string.c Examining data/libhx-3.25/src/tc-strquote.c Examining data/libhx-3.25/src/tc-time.c Examining data/libhx-3.25/src/tc-xml.c Examining data/libhx-3.25/src/time.c Examining data/libhx-3.25/src/tx-cast.cpp Examining data/libhx-3.25/src/tx-compile.cpp Examining data/libhx-3.25/src/tx-deque.cpp Examining data/libhx-3.25/src/tx-dir.cpp Examining data/libhx-3.25/src/tx-list.cpp Examining data/libhx-3.25/src/tx-list2.cpp Examining data/libhx-3.25/src/tx-misc.cpp Examining data/libhx-3.25/src/tx-netio.cpp Examining data/libhx-3.25/src/tx-option.cpp Examining data/libhx-3.25/src/tx-proc.cpp Examining data/libhx-3.25/src/tx-rand.cpp Examining data/libhx-3.25/src/tx-strchr2.cpp Examining data/libhx-3.25/src/tx-string.cpp Examining data/libhx-3.25/src/tx-strquote.cpp Examining data/libhx-3.25/src/tx-time.cpp Examining data/libhx-3.25/src/ux-file.c Examining data/libhx-3.25/src/ux-mmap.c Examining data/libhx-3.25/src/uxcompat.h Examining data/libhx-3.25/src/io.c FINAL RESULTS: data/libhx-3.25/src/io.c:248:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. if (readlink(fsrc, pt, MAXFNLEN - 1) < MAXFNLEN - 1) data/libhx-3.25/src/io.c:260:4: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(fdest, sb.st_mode); data/libhx-3.25/src/io.c:318:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ret = readlink(path, tb, PATH_MAX); data/libhx-3.25/src/tc-link.c:133:2: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown, data/libhx-3.25/src/tc-link.c:140:2: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. readlink, data/libhx-3.25/src/ux-file.c:5:19: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. EXPORT_SYMBOL int chown(const char *path, long uid, long gid) data/libhx-3.25/src/ux-file.c:40:19: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. EXPORT_SYMBOL int readlink(const char *path, char *dest, size_t len) data/libhx-3.25/src/uxcompat.h:75:12: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. extern int chown(const char *, long, long); data/libhx-3.25/src/uxcompat.h:82:12: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. extern int readlink(const char *, char *, size_t); data/libhx-3.25/src/format.c:462:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(buf, sizeof(buf), (fmt), \ data/libhx-3.25/src/format.c:466:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(buf, sizeof(buf), (fmt), \ data/libhx-3.25/src/internal.h:32:10: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define snprintf _snprintf data/libhx-3.25/src/internal.h:32:19: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. # define snprintf _snprintf data/libhx-3.25/src/io.c:84: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(d->dname, s); data/libhx-3.25/src/proc.c:205:4: [4] (shell) execv: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execv(prog, const_cast2(char * const *, argv)); data/libhx-3.25/src/proc.c:207:4: [4] (shell) execvp: 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. execvp(prog, const_cast2(char * const *, argv)); data/libhx-3.25/src/string.c:317: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(*pa, pb); data/libhx-3.25/src/tc-compile.c:36:2: [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(HX_STRINGIFY(1234+2 +2) "," HX_STRINGIFY(ZZ) "\n"); data/libhx-3.25/src/tc-map.c:59:2: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/libhx-3.25/src/tc-memmem.c:69:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&delta)); data/libhx-3.25/src/tc-time.c:121:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:127:3: [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(HX_TIMESPEC_FMT " + 0 = ", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:129:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:135:3: [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(HX_TIMESPEC_FMT " - 0 = ", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:137:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:143:3: [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(HX_TIMESPEC_FMT " * 1 = ", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:145:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:152:3: [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(HX_TIMESPEC_FMT " + " HX_TIMESPEC_FMT " = ", data/libhx-3.25/src/tc-time.c:155:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:161:3: [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(HX_TIMESPEC_FMT " - " HX_TIMESPEC_FMT " = ", data/libhx-3.25/src/tc-time.c:164:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:171:2: [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(HX_timespec_isneg(a) ? "[-]" : "[+]"); data/libhx-3.25/src/tc-time.c:184:3: [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(HX_TIMESPEC_FMT " -> ", HX_TIMESPEC_EXP(now)); data/libhx-3.25/src/tc-time.c:186:3: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&then)); data/libhx-3.25/src/tc-time.c:194:2: [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(HX_TIMESPEC_FMT " %s ", HX_TIMESPEC_EXP(a), op); data/libhx-3.25/src/tc-time.c:195:2: [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(HX_TIMESPEC_FMT " = ", HX_TIMESPEC_EXP(b)); data/libhx-3.25/src/tc-time.c:196:2: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(r)); data/libhx-3.25/src/tc-time.c:284:2: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&delta)); data/libhx-3.25/src/tc-time.c:305:4: [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(HX_TIMESPEC_FMT " *N %d = ", data/libhx-3.25/src/tc-time.c:308:4: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:310:4: [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(HX_TIMESPEC_FMT " *S %d = ", data/libhx-3.25/src/tc-time.c:313:4: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&s)); data/libhx-3.25/src/tc-time.c:320:4: [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(HX_TIMESPEC_FMT " *fN %f = ", data/libhx-3.25/src/tc-time.c:323:4: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&r)); data/libhx-3.25/src/tc-time.c:325:4: [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(HX_TIMESPEC_FMT " *fS %f = ", data/libhx-3.25/src/tc-time.c:328:4: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&s)); data/libhx-3.25/src/tc-time.c:349:2: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&delta)); data/libhx-3.25/src/tc-time.c:366:2: [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(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&delta)); data/libhx-3.25/src/dl.c:21:9: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. return LoadLibrary(file); data/libhx-3.25/src/format.c:193:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. s = getenv(argv[0]); data/libhx-3.25/src/opt.c:140:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. s = getenv("POSIXLY_CORRECT"); data/libhx-3.25/src/rand.c:70:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(seed); data/libhx-3.25/assorted/pack.c:33: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(buf, src, slen); data/libhx-3.25/assorted/pack.c:80: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(buf += 2, src, slen); data/libhx-3.25/assorted/pack.c:93: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(buf, src, slen); data/libhx-3.25/doc/slurp.c:4:20: [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 ret = 0, fd = open(file, O_RDONLY | O_BINARY); data/libhx-3.25/include/libHX/string.h:99:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return memcpy(ret, buf, len); data/libhx-3.25/src/format.c:46:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char delim[4]; data/libhx-3.25/src/format.c:471: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[HXSIZEOF_Z64]; data/libhx-3.25/src/io.c:85:2: [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(d->dname, "\\*"); data/libhx-3.25/src/io.c:167: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[MAXLNLEN]; data/libhx-3.25/src/io.c:171:12: [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 ((sd = open(src, O_RDONLY | O_BINARY)) < 0) data/libhx-3.25/src/io.c:175: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). dd = open(dest, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC | data/libhx-3.25/src/io.c:229: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 fsrc[MAXFNLEN], fdest[MAXFNLEN]; data/libhx-3.25/src/io.c:246:4: [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 pt[MAXFNLEN]; data/libhx-3.25/src/io.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[MAXFNLEN], dir[MAXFNLEN]; data/libhx-3.25/src/map.c:683:11: [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 dir[RBT_MAXDEP]; data/libhx-3.25/src/map.c:933:11: [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 dir[RBT_MAXDEP]; data/libhx-3.25/src/map.c:1239: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 newdir[RBT_MAXDEP] = {}; data/libhx-3.25/src/map_int.h:116:11: [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 dir[RBT_MAXDEP]; data/libhx-3.25/src/mc.c:85: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(ctx->data, ptr, ctx->length = len); data/libhx-3.25/src/mc.c:151: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(ctx->data + ctx->length, ptr, len); data/libhx-3.25/src/mc.c:200: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(ctx->data + pos, ptr, len); data/libhx-3.25/src/opt.c:802: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 tmp[84] = {'\0'}; data/libhx-3.25/src/opt.c:838: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 tmp[84] = {}; data/libhx-3.25/src/opt.c:949:12: [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 ((fp = fopen(file, "r")) == NULL) data/libhx-3.25/src/opt.c:977:12: [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 ((fp = fopen(file, "r")) == NULL) { data/libhx-3.25/src/opt.c:995: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[MAXFNLEN]; data/libhx-3.25/src/proc.c:134:17: [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 ((nullfd = open(NULL_DEVICE, O_RDWR)) < 0) data/libhx-3.25/src/rand.c:64:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open("/dev/urandom", O_RDONLY | O_BINARY)) >= 0) { data/libhx-3.25/src/string.c:41: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. static const char HX_hexenc[16] = "0123456789ABCDEF"; data/libhx-3.25/src/string.c:132: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 temp[MAXLNLEN]; data/libhx-3.25/src/string.c:412: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(ret, src, size); data/libhx-3.25/src/string.c:566: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(dest, src, len); data/libhx-3.25/src/string.c:589: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(dest, src, len); data/libhx-3.25/src/string.c:670: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(dest, (s), sizeof(s) - 1); \ data/libhx-3.25/src/string.c:679: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(dest, src, len); data/libhx-3.25/src/string.c:705: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(dest, src, len); data/libhx-3.25/src/string.c:728: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(dest, src, len); data/libhx-3.25/src/tc-compile.c:17:11: [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 bmchar[HXbitmap_size(unsigned char, 256)]; data/libhx-3.25/src/tc-list.c:22: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 id[5]; data/libhx-3.25/src/tc-map.c:99: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 key[8], value[HXSIZEOF_Z32]; data/libhx-3.25/src/tc-map.c:234: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 key[8], value[HXSIZEOF_Z32]; data/libhx-3.25/src/tc-map.c:341: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[HXSIZEOF_Z32]; data/libhx-3.25/src/tc-map.c:550: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[80]; data/libhx-3.25/src/tc-string.c:91: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 data[5] = "DATA"; data/libhx-3.25/src/tc-string.c:156: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 t2[sizeof(t1)]; data/libhx-3.25/src/tc-string.c:158: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 **a0, **a1, *a2[10]; data/libhx-3.25/src/tc-string.c:161: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(t2, t1, sizeof(t1)); data/libhx-3.25/src/tc-string.c:216:30: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return static_cast(char *, memcpy(dest, src, slen + 1)); data/libhx-3.25/src/tc-string.c:218: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, dsize - 1); data/libhx-3.25/src/tc-string.c:249: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 ibuf[2048], obuf[2048]; data/libhx-3.25/src/tc-string.c:261: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. f_strlcpy_str(reinterpret_cast(char *, obuf), data/libhx-3.25/src/tc-string.c:268: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. f_strlcpy_mem(reinterpret_cast(char *, obuf), data/libhx-3.25/src/tc-string.c:286: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 a[3] = {49, 49, 49}; data/libhx-3.25/src/tc-string.c:300: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). fp = fopen(file, "r"); data/libhx-3.25/assorted/pack.c:27: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 slen = strlen(src) & 0xFF; data/libhx-3.25/assorted/pack.c:74: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 slen = strlen(src) & 0xFFFF; data/libhx-3.25/doc/slurp.c:25:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rdret = read(fd, buf, *outsize); data/libhx-3.25/src/format.c:152:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return const_cast1(char *, s) + strlen(s); data/libhx-3.25/src/format.c:247:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ret = read(proc.p_stdout, slurp, BUFSIZ)) > 0) data/libhx-3.25/src/format.c:314:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). z = strlen(argv[0]); data/libhx-3.25/src/format.c:715:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, str, size); data/libhx-3.25/src/io.c:80: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). if ((d->dname = malloc(strlen(s) + 3)) == NULL) { data/libhx-3.25/src/io.c:186:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((l = read(sd, buf, MAXLNLEN)) > 0 && write(dd, buf, l) > 0) data/libhx-3.25/src/io.c:269: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). int i = 0, len = strlen(idir); data/libhx-3.25/src/io.c:291:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, dir, i); data/libhx-3.25/src/io.c:296:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, dir, len); data/libhx-3.25/src/io.c:417: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). if (HXmc_setlen(&state.dest, strlen(state.dest)) == NULL) data/libhx-3.25/src/io.c:545:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, rem); data/libhx-3.25/src/map.c:193: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). return HXhash_jlookup3(p, strlen(p)); data/libhx-3.25/src/mc.c:37: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). size_t z = strlen(s); data/libhx-3.25/src/mc.c:56: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). return HXmc_memcpy(vp, s, strlen(s)); data/libhx-3.25/src/mc.c:133: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). return HXmc_memcat(vp, s, strlen(s)); data/libhx-3.25/src/mc.c:162: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). return HXmc_memins(vp, 0, s, strlen(s)); data/libhx-3.25/src/mc.c:175: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). return HXmc_memins(vp, pos, s, strlen(s)); data/libhx-3.25/src/opt.c:252: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). size_t klen = strlen(key); data/libhx-3.25/src/opt.c:334:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(msg) < rest) { data/libhx-3.25/src/opt.c:812: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). if ((tl = strlen(tmp)) > tw) data/libhx-3.25/src/opt.c:845: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). wd = sizeof("Usage:") + strlen(arg0); data/libhx-3.25/src/opt.c:885: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). if (wd + strlen(tmp) > SCREEN_WIDTH) { data/libhx-3.25/src/rand.c:65:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &seed, sizeof(seed)); data/libhx-3.25/src/string.c:52: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 (p = s + strlen(s) - 1; p >= s && *p == '/'; --p) data/libhx-3.25/src/string.c:60:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return const_cast1(char *, s + strlen(s) - 1); data/libhx-3.25/src/string.c:75:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). for (end = s + strlen(s) - 1; end >= s && *end == '/'; --end) data/libhx-3.25/src/string.c:98: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). char *p = s + strlen(s) - 1; data/libhx-3.25/src/string.c:115: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). for (last = s + strlen(s) - 1; last > s && *last == '/'; --last) data/libhx-3.25/src/string.c:315: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 ((*pa = malloc(strlen(pb) + 1)) == NULL) data/libhx-3.25/src/string.c:326:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return HX_memdup(src, strlen(src) + 1); data/libhx-3.25/src/string.c:331: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). ssize_t x = len - strlen(dest) - 1; data/libhx-3.25/src/string.c:334:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. return strncat(dest, src, x); data/libhx-3.25/src/string.c:341:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, src, n); data/libhx-3.25/src/string.c:349: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). ssize_t x = dlen - strlen(dest) - 1; data/libhx-3.25/src/string.c:353:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. return strncat(dest, src, x); data/libhx-3.25/src/string.c:373:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(expr, travp, strlen(travp) + 1); data/libhx-3.25/src/string.c:390: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). offset = strlen(expr) + offset; data/libhx-3.25/src/string.c:392: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). length = strlen(expr) - offset + length; data/libhx-3.25/src/string.c:407:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). z = strlen(src); data/libhx-3.25/src/string.c:427: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). size_t n = strlen(s); data/libhx-3.25/src/string.c:437: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). size_t i, z = strlen(s)-1, z2 = z / 2; data/libhx-3.25/src/string.c:451:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int i = strlen(expr), s = 0; data/libhx-3.25/src/string.c:498: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). *wp = ptr + strlen(str); data/libhx-3.25/src/string.c:528: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). size_t n = strlen(s); data/libhx-3.25/src/string.c:549: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). size_t n = strlen(s); data/libhx-3.25/src/string.c:613: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). size_t len = strlen(s); data/libhx-3.25/src/string.c:646: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). size_t n = strlen(s); data/libhx-3.25/src/string.c:764:11: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return (strlen(s) + 2) / 3 * 4; data/libhx-3.25/src/string.c:768:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return strlen(s); data/libhx-3.25/src/tc-memmem.c:33: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). p = HX_memmem(filler2, strlen(filler2), "al", 2); data/libhx-3.25/src/tc-memmem.c:56:40: [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("%p\n", HX_memmem(filler_text, strlen(filler_text), "nangl", 5)); data/libhx-3.25/src/tc-memmem.c:57:40: [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("%p\n", HX_memmem(filler_text, strlen(filler_text), "angl", 4)); data/libhx-3.25/src/tc-memmem.c:58:40: [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("%p\n", HX_memmem(filler_text, strlen(filler_text), "ngl", 3)); data/libhx-3.25/src/tc-memmem.c:59:40: [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("%p\n", HX_memmem(filler_text, strlen(filler_text), "ngl", 3)); data/libhx-3.25/src/tc-netio.c:53: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). if (HXio_fullwrite(fd, id, strlen(id)) < 0) data/libhx-3.25/src/tc-string.c:116:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). HX_strnlen(s, strlen(s)), HX_strnlen(s, 999)); data/libhx-3.25/src/tc-string.c:207:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(d, s, n); data/libhx-3.25/src/tc-string.c:214: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). size_t slen = strlen(src); data/libhx-3.25/src/tc-string.c:275:5: [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). strlen(ibuf), picksizes[opick], ANALYSIS SUMMARY: Hits = 168 Lines analyzed = 11122 in approximately 0.51 seconds (21642 lines/second) Physical Source Lines of Code (SLOC) = 8590 Hits@level = [0] 216 [1] 62 [2] 54 [3] 4 [4] 39 [5] 9 Hits@level+ = [0+] 384 [1+] 168 [2+] 106 [3+] 52 [4+] 48 [5+] 9 Hits/KSLOC@level+ = [0+] 44.7031 [1+] 19.5576 [2+] 12.3399 [3+] 6.05355 [4+] 5.58789 [5+] 1.04773 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.