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/publib-0.40/iset/iset_copy.c Examining data/publib-0.40/iset/iset_range.c Examining data/publib-0.40/iset/iset_isect.c Examining data/publib-0.40/iset/iset_add.c Examining data/publib-0.40/iset/iset_create.c Examining data/publib-0.40/iset/iset_is_empty.c Examining data/publib-0.40/iset/iset_add_rng.c Examining data/publib-0.40/iset/iset_nth_rng.c Examining data/publib-0.40/iset/iset_clear.c Examining data/publib-0.40/iset/iset_contains.c Examining data/publib-0.40/iset/iset_rm_rng.c Examining data/publib-0.40/iset/iset_remove.c Examining data/publib-0.40/iset/iset_diff.c Examining data/publib-0.40/iset/iset_union.c Examining data/publib-0.40/iset/test_add.c Examining data/publib-0.40/iset/iset_destroy.c Examining data/publib-0.40/lockfile/lockfile.c Examining data/publib-0.40/alloc/memdup.c Examining data/publib-0.40/alloc/dynarr.c Examining data/publib-0.40/alloc/xrealloc.c Examining data/publib-0.40/alloc/xfree.c Examining data/publib-0.40/alloc/xmemdup.c Examining data/publib-0.40/alloc/xstrdup.c Examining data/publib-0.40/alloc/xmalloc.c Examining data/publib-0.40/main/test-main-filter.c Examining data/publib-0.40/main/main_filter.c Examining data/publib-0.40/log/log.c Examining data/publib-0.40/log/test-log.c Examining data/publib-0.40/base64/base64.c Examining data/publib-0.40/strutil/memarrfill.c Examining data/publib-0.40/strutil/strvars.c Examining data/publib-0.40/strutil/memrmem.c Examining data/publib-0.40/strutil/memshuffle.c Examining data/publib-0.40/strutil/strmove.c Examining data/publib-0.40/strutil/strdiff.c Examining data/publib-0.40/strutil/strrev.c Examining data/publib-0.40/strutil/strtrim.c Examining data/publib-0.40/strutil/strhash.c Examining data/publib-0.40/strutil/strtrexpand.c Examining data/publib-0.40/strutil/memdel.c Examining data/publib-0.40/strutil/strset.c Examining data/publib-0.40/strutil/strcstr.c Examining data/publib-0.40/strutil/stracat.c Examining data/publib-0.40/strutil/strrstr.c Examining data/publib-0.40/strutil/strchange.c Examining data/publib-0.40/strutil/memins.c Examining data/publib-0.40/strutil/strmtrim.c Examining data/publib-0.40/strutil/strins.c Examining data/publib-0.40/strutil/strndup.c Examining data/publib-0.40/strutil/strendzap.c Examining data/publib-0.40/strutil/strshuffle.c Examining data/publib-0.40/strutil/strzap.c Examining data/publib-0.40/strutil/strright.c Examining data/publib-0.40/strutil/struncstr.c Examining data/publib-0.40/strutil/strinit.c Examining data/publib-0.40/strutil/strnins.c Examining data/publib-0.40/strutil/memmem.c Examining data/publib-0.40/strutil/memfill.c Examining data/publib-0.40/strutil/strsub.c Examining data/publib-0.40/strutil/struntabify.c Examining data/publib-0.40/strutil/stroverlap.c Examining data/publib-0.40/strutil/strrtrim.c Examining data/publib-0.40/strutil/strend.c Examining data/publib-0.40/strutil/memrev.c Examining data/publib-0.40/strutil/memoverlap.c Examining data/publib-0.40/strutil/stranaxfrm.c Examining data/publib-0.40/strutil/strltrim.c Examining data/publib-0.40/strutil/strgsub.c Examining data/publib-0.40/strutil/strnlen.c Examining data/publib-0.40/strutil/strrot13.c Examining data/publib-0.40/strutil/memrchr.c Examining data/publib-0.40/strutil/strmaxcpy.c Examining data/publib-0.40/strutil/memswap.c Examining data/publib-0.40/strutil/strtabify.c Examining data/publib-0.40/strutil/strsplit.c Examining data/publib-0.40/strutil/memisort.c Examining data/publib-0.40/strutil/strdel.c Examining data/publib-0.40/strutil/strcins.c Examining data/publib-0.40/files/xgetaline.c Examining data/publib-0.40/files/getaline.c Examining data/publib-0.40/files/xfopen.c Examining data/publib-0.40/files/xfclose.c Examining data/publib-0.40/files/fassert.c Examining data/publib-0.40/files/xfseek.c Examining data/publib-0.40/files/file_io.c Examining data/publib-0.40/tbuf/test_tbuf_with_stats.c Examining data/publib-0.40/tbuf/tbuf.c Examining data/publib-0.40/tbuf/test_tbuf.c Examining data/publib-0.40/queue/queue.c Examining data/publib-0.40/queue/test-queue.c Examining data/publib-0.40/sbuf/test-colmark.c Examining data/publib-0.40/sbuf/sbuf_srch.c Examining data/publib-0.40/sbuf/sbuf_io.c Examining data/publib-0.40/sbuf/test-sbuf-undo.c Examining data/publib-0.40/sbuf/test-sbuf.c Examining data/publib-0.40/sbuf/sbuf_aux.c Examining data/publib-0.40/sbuf/sbuf.c Examining data/publib-0.40/stack/stack_create.c Examining data/publib-0.40/stack/stack_destroy.c Examining data/publib-0.40/stack/stack_emptyp.c Examining data/publib-0.40/stack/stack_push.c Examining data/publib-0.40/stack/stack_copy.c Examining data/publib-0.40/stack/stack_pop.c Examining data/publib-0.40/bitarr/ba_clear.c Examining data/publib-0.40/bitarr/ba_query.c Examining data/publib-0.40/bitarr/ba_destroy.c Examining data/publib-0.40/bitarr/ba_copy.c Examining data/publib-0.40/bitarr/ba_resize.c Examining data/publib-0.40/bitarr/ba_clear_all.c Examining data/publib-0.40/bitarr/ba_not.c Examining data/publib-0.40/bitarr/ba_or_ba.c Examining data/publib-0.40/bitarr/ba_set.c Examining data/publib-0.40/bitarr/ba_create.c Examining data/publib-0.40/bitarr/ba_xor_ba.c Examining data/publib-0.40/bitarr/ba_or_not_ba.c Examining data/publib-0.40/bitarr/ba_and_ba.c Examining data/publib-0.40/includes/publib/hash.h Examining data/publib-0.40/includes/publib/bitarr.h Examining data/publib-0.40/includes/publib/lockfile.h Examining data/publib-0.40/includes/publib/log.h Examining data/publib-0.40/includes/publib/queue.h Examining data/publib-0.40/includes/publib/nntp.h Examining data/publib-0.40/includes/publib/priq.h Examining data/publib-0.40/includes/publib/fname.h Examining data/publib-0.40/includes/publib/base64.h Examining data/publib-0.40/includes/publib/main.h Examining data/publib-0.40/includes/publib/errormsg.h Examining data/publib-0.40/includes/publib/tbuf.h Examining data/publib-0.40/includes/publib/cmp.h Examining data/publib-0.40/includes/publib/alloc.h Examining data/publib-0.40/includes/publib/files.h Examining data/publib-0.40/includes/publib/sbuf.h Examining data/publib-0.40/includes/publib/iset.h Examining data/publib-0.40/includes/publib/stack.h Examining data/publib-0.40/includes/publib/strutil.h Examining data/publib-0.40/includes/publib.h Examining data/publib-0.40/priq/test-priq.c Examining data/publib-0.40/priq/priq.c Examining data/publib-0.40/cmp/cmp.c Examining data/publib-0.40/nntp/nntpart.c Examining data/publib-0.40/nntp/nntp.c Examining data/publib-0.40/errormsg/errormsg.c Examining data/publib-0.40/hash/hash_iter.c Examining data/publib-0.40/hash/hash_lookup.c Examining data/publib-0.40/hash/hash_install.c Examining data/publib-0.40/hash/hash_uninstall.c Examining data/publib-0.40/hash/hash_destroy.c Examining data/publib-0.40/hash/hash_create.c Examining data/publib-0.40/fname/fnjoin.c Examining data/publib-0.40/fname/fndelend.c Examining data/publib-0.40/fname/fnqualify.c Examining data/publib-0.40/fname/fnsetsuf.c Examining data/publib-0.40/fname/fnlastsuf.c Examining data/publib-0.40/fname/fndelbeg.c Examining data/publib-0.40/fname/fndir.c Examining data/publib-0.40/fname/fnhome.c Examining data/publib-0.40/fname/test_fnqualify.c Examining data/publib-0.40/fname/fnpathfind.c Examining data/publib-0.40/fname/fnbase.c Examining data/publib-0.40/fname/fndelsuf.c FINAL RESULTS: data/publib-0.40/files/file_io.c:234:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(tgt, st.st_mode) == -1) { data/publib-0.40/sbuf/sbuf_io.c:309:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(tgt, mode) == -1) { data/publib-0.40/errormsg/errormsg.c:108:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, args); data/publib-0.40/files/file_io.c:192: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(buf, original); data/publib-0.40/files/file_io.c:252:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(back, "%s~", orig); data/publib-0.40/fname/fnhome.c:58: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(homedir, pwd->pw_dir); data/publib-0.40/fname/fnjoin.c:56:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(res, "%s%s%s", f1, p, f2); data/publib-0.40/fname/fnpathfind.c:94:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(p, tgt); data/publib-0.40/fname/fnpathfind.c:97:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(fullname, 00) == 00) { data/publib-0.40/fname/fnqualify.c:75:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(result + len, "/%s", path); data/publib-0.40/fname/fnqualify.c:107:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(result, "%s/%s", pwd->pw_dir, p); data/publib-0.40/fname/fnsetsuf.c:53: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(fname, suffix); data/publib-0.40/fname/fnsetsuf.c:58:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(dot, suffix); data/publib-0.40/includes/publib/files.h:69:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. /**/int snprintf(char *, size_t, const char *, ...); data/publib-0.40/log/log.c:159:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf2, buf1, p, pid, log_level_##level);\ data/publib-0.40/log/log.c:163:11: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void) vfprintf(logs[i].f, fmt, args); \ data/publib-0.40/log/log.c:204:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf2, buf1, p, pid, level); data/publib-0.40/log/log.c:208:11: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void) vfprintf(logs[i].f, fmt, args); data/publib-0.40/nntp/nntp.c:315: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(buf, line); data/publib-0.40/nntp/nntp.c:349:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, fmt, args); data/publib-0.40/nntp/nntpart.c:125:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s: %s", hdr, s); data/publib-0.40/nntp/nntpart.c:284:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s, %02d %s %02d %02d:%02d:%02d GMT", data/publib-0.40/sbuf/sbuf.c:1015:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(log, fmt, args); data/publib-0.40/sbuf/sbuf_io.c:261: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(buf, original); data/publib-0.40/sbuf/sbuf_io.c:327:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(back, "%s~", orig); data/publib-0.40/files/file_io.c:190:9: [3] (random) random: 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. time_t random; data/publib-0.40/files/file_io.c:199:8: [3] (random) random: 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. time(&random); data/publib-0.40/files/file_io.c:203:43: [3] (random) random: 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. sprintf(p, "#%lu-%lu#", (unsigned long) random, i); data/publib-0.40/sbuf/sbuf_io.c:259:9: [3] (random) random: 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. time_t random; data/publib-0.40/sbuf/sbuf_io.c:268:8: [3] (random) random: 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. time(&random); data/publib-0.40/sbuf/sbuf_io.c:272:43: [3] (random) random: 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. sprintf(p, "#%lu-%lu#", (unsigned long) random, i); data/publib-0.40/alloc/dynarr.c:73: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(copy->data, orig->data, orig->elsize * orig->used); data/publib-0.40/alloc/memdup.c:52: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(q, p, n); data/publib-0.40/files/file_io.c:87:6: [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). f = fopen(pathname, "r"); data/publib-0.40/files/file_io.c:106:6: [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). f = fopen(pathname, "w"); data/publib-0.40/files/file_io.c:124: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_name[FILENAME_MAX]; data/publib-0.40/files/file_io.c:125: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 back_name[sizeof(temp_name) + 4]; data/publib-0.40/files/file_io.c:203:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(p, "#%lu-%lu#", (unsigned long) random, i); data/publib-0.40/files/file_io.c:204:9: [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(buf, O_WRONLY | O_CREAT | O_EXCL, 0600); data/publib-0.40/files/xfopen.c:45:6: [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). f = fopen(filename, mode); data/publib-0.40/fname/fndir.c:49: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(dir, fname, (size_t)(base-fname)); data/publib-0.40/fname/fnqualify.c:52:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char username[USERNAME_MAX]; data/publib-0.40/fname/fnqualify.c:94: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(username, path+1, size); data/publib-0.40/fname/test_fnqualify.c:42:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[FILENAME_MAX]; data/publib-0.40/hash/hash_install.c:67: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(p->data, data, size); data/publib-0.40/lockfile/lockfile.c:54:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tempname[FILENAME_MAX + 256]; /* enough for template */ data/publib-0.40/lockfile/lockfile.c:55:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dir[FILENAME_MAX]; data/publib-0.40/lockfile/lockfile.c:66: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(tempname, O_CREAT | O_EXCL, 0600); data/publib-0.40/log/log.c:63:6: [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). f = fopen(filename, "a"); data/publib-0.40/log/log.c:139:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf1[100]; \ data/publib-0.40/log/log.c:140:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf2[200]; \ data/publib-0.40/log/log.c:179: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 buf1[100]; data/publib-0.40/log/log.c:180: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 buf2[100]; data/publib-0.40/main/main_filter.c:63:9: [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). f = fopen(v[i], "r"); data/publib-0.40/nntp/nntp.c:147: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(&serv.sin_addr, he->h_addr_list[0], he->h_length); data/publib-0.40/nntp/nntp.c:283:9: [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 buf[1024]; /* should be long enough */ data/publib-0.40/nntp/nntp.c:305: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[10240]; data/publib-0.40/nntp/nntp.c:346: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[10240]; data/publib-0.40/nntp/nntp.c:359: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(buf, "\r\n"); data/publib-0.40/nntp/nntp.c:373: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[10240]; data/publib-0.40/nntp/nntp.c:379:9: [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). code = atoi(buf); data/publib-0.40/nntp/nntpart.c:278:9: [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[1024]; data/publib-0.40/sbuf/sbuf.c:539: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(str, p + m->begin, m->len); data/publib-0.40/sbuf/sbuf.c:579: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, tempbuf[10240]; data/publib-0.40/sbuf/sbuf.c:660: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[1000]; data/publib-0.40/sbuf/sbuf.c:752: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(log->oldtext, oldtext, oldlen); data/publib-0.40/sbuf/sbuf.c:828: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(buf->block + buf->gappos, s, n); data/publib-0.40/sbuf/sbuf.c:1009:9: [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). log = fopen("/home/liw/sbuf-changes-log", "a"); data/publib-0.40/sbuf/sbuf_io.c:75:6: [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). f = fopen(buf->name, "r"); data/publib-0.40/sbuf/sbuf_io.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 temp_name[FILENAME_MAX]; data/publib-0.40/sbuf/sbuf_io.c:100: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 back_name[sizeof(temp_name) + 4]; data/publib-0.40/sbuf/sbuf_io.c:166: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 iobuf[IO_BUFFER_SIZE]; data/publib-0.40/sbuf/sbuf_io.c:192:6: [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). f = fopen(filename, "w"); data/publib-0.40/sbuf/sbuf_io.c:217: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 iobuf[IO_BUFFER_SIZE]; data/publib-0.40/sbuf/sbuf_io.c:272:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(p, "#%lu-%lu#", (unsigned long) random, i); data/publib-0.40/sbuf/sbuf_io.c:273:9: [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(buf, O_WRONLY | O_CREAT | O_EXCL, 0600); data/publib-0.40/sbuf/test-colmark.c:72: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 foo[1000]; data/publib-0.40/sbuf/test-sbuf-undo.c: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 tmp[1024]; data/publib-0.40/sbuf/test-sbuf.c: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 tmp[1024]; data/publib-0.40/sbuf/test-sbuf.c:164: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 foo[1000]; data/publib-0.40/stack/stack_copy.c:78: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(cp->data[i], st->data[i], st->size[i]); data/publib-0.40/stack/stack_push.c:84: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(p, data, bytes); data/publib-0.40/strutil/memfill.c:51: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(p, pat, patsize); data/publib-0.40/strutil/memfill.c:52: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, pat, bufsize); data/publib-0.40/strutil/memins.c:49: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(tgt, src, srcsize); data/publib-0.40/strutil/memisort.c:59: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, new, elsize); data/publib-0.40/strutil/memswap.c:44:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *s, *t, buf[N]; data/publib-0.40/strutil/memswap.c:53: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(buf, s, N); data/publib-0.40/strutil/memswap.c:54: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(s, t, N); data/publib-0.40/strutil/memswap.c:55: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(t, buf, N); data/publib-0.40/strutil/memswap.c:60: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(buf, s, n); data/publib-0.40/strutil/memswap.c:61: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(s, t, n); data/publib-0.40/strutil/memswap.c:62: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(t, buf, n); data/publib-0.40/strutil/stracat.c:102: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(block, s, lentab[0]); data/publib-0.40/strutil/stracat.c:108: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(q, p, len); data/publib-0.40/strutil/strchange.c:54: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(str, new, newlen); data/publib-0.40/strutil/strins.c:49: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(tgt, src, srclen); data/publib-0.40/strutil/strndup.c:57: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(dup, str, n); data/publib-0.40/strutil/strnins.c:51: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(tgt, src, srclen); data/publib-0.40/strutil/strsub.c:60: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(str, sub, lensub); data/publib-0.40/strutil/strvars.c:55: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(*r + *size, str, n); data/publib-0.40/tbuf/tbuf.c:268: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(chunk->chars, *chars, n); data/publib-0.40/tbuf/tbuf.c:506: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(*chars, chunk->chars + off, n); data/publib-0.40/tbuf/tbuf.c:914: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[CHUNK_MAX]; data/publib-0.40/tbuf/tbuf.c:929: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(buf, chunk1->chars, len1); data/publib-0.40/tbuf/tbuf.c:930: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(buf + len1, chunk2->chars, len2); data/publib-0.40/tbuf/test_tbuf.c:76: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[10240]; data/publib-0.40/tbuf/test_tbuf_with_stats.c:148: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). f = fopen(argv[1], "r"); data/publib-0.40/errormsg/errormsg.c:111: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(fmt); data/publib-0.40/files/file_io.c:62:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(f)) != EOF && !ferror(stdout)) { data/publib-0.40/files/file_io.c:127:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(name) + 64 > sizeof(temp_name)) { data/publib-0.40/files/file_io.c:249:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(orig) + 2 > max) data/publib-0.40/files/getaline.c:70:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += strlen(buf+len); data/publib-0.40/fname/fndelbeg.c:45:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(fname, fname+1, strlen(fname)+1); data/publib-0.40/fname/fndelbeg.c:51:22: [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(fname, p, strlen(p) + 1); data/publib-0.40/fname/fndir.c:47:3: [1] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant character. strcpy(dir, "."); data/publib-0.40/fname/fnpathfind.c:60: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). tgtlen = strlen(tgt); data/publib-0.40/fname/fnpathfind.c:90:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fullname, path, dirlen); data/publib-0.40/fname/fnpathfind.c:98:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(result, fullname, max); data/publib-0.40/fname/fnqualify.c:60:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(result, path, max); data/publib-0.40/fname/fnqualify.c:62: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(path) + 1; data/publib-0.40/fname/fnqualify.c:71:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(result); data/publib-0.40/fname/fnqualify.c:72:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size = len + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ data/publib-0.40/fname/fnqualify.c:105:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size = strlen(pwd->pw_dir) + 1 + strlen(p) + 1; data/publib-0.40/fname/fnqualify.c:105:35: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size = strlen(pwd->pw_dir) + 1 + strlen(p) + 1; data/publib-0.40/fname/fnsetsuf.c:50: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). needed = strlen(fname) + strlen(suffix) + 1; data/publib-0.40/fname/fnsetsuf.c:50: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). needed = strlen(fname) + strlen(suffix) + 1; data/publib-0.40/fname/fnsetsuf.c:55: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). needed = (strlen(fname) - strlen(dot)) + strlen(suffix) + 1; data/publib-0.40/fname/fnsetsuf.c:55: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). needed = (strlen(fname) - strlen(dot)) + strlen(suffix) + 1; data/publib-0.40/fname/fnsetsuf.c:55: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). needed = (strlen(fname) - strlen(dot)) + strlen(suffix) + 1; data/publib-0.40/lockfile/lockfile.c:59:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(lockname) > FILENAME_MAX) { data/publib-0.40/main/test-main-filter.c:45:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(f)) != EOF) data/publib-0.40/nntp/nntp.c:309: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). n = strlen(line); data/publib-0.40/nntp/nntp.c:314: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/publib-0.40/nntp/nntp.c:352:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(buf) > 510) { data/publib-0.40/nntp/nntp.c:420:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, p, need); data/publib-0.40/nntp/nntp.c:445: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). len = strlen(s); data/publib-0.40/nntp/nntpart.c:122: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). buf = malloc(strlen(hdr) + 2 + strlen(s) + 2); data/publib-0.40/nntp/nntpart.c:122: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). buf = malloc(strlen(hdr) + 2 + strlen(s) + 2); data/publib-0.40/nntp/nntpart.c:230: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). hdr_len = strlen(hdr); data/publib-0.40/sbuf/sbuf_aux.c:502: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). assert(strlen((char*)pairstr) % 2 == 0); data/publib-0.40/sbuf/sbuf_io.c:107:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(buf->name) + 64 > sizeof(temp_name)) { data/publib-0.40/sbuf/sbuf_io.c:304:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode = umask(0); data/publib-0.40/sbuf/sbuf_io.c:305:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(mode); data/publib-0.40/sbuf/sbuf_io.c:324:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(orig) + 2 > max) data/publib-0.40/sbuf/test-sbuf.c:99: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). sbuf_strchange(mark2, what, strlen(what)); data/publib-0.40/sbuf/test-sbuf.c:107:39: [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). ret = sbuf_search(mark2, mark1, str, strlen(str), opts); data/publib-0.40/strutil/stracat.c:79: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). lentab[0] = strlen(s); data/publib-0.40/strutil/stracat.c:83:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(p); data/publib-0.40/strutil/stracat.c:107: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). len = (i < n) ? lentab[i++] : strlen(p); data/publib-0.40/strutil/strchange.c:47: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). n = strlen(str); data/publib-0.40/strutil/strchange.c:50: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). n = strlen(new); data/publib-0.40/strutil/strchange.c:53:37: [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(str+newlen, str+changelen, strlen(str+changelen)+1); data/publib-0.40/strutil/strcins.c:43:22: [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(str+1, str, strlen(str)+1); data/publib-0.40/strutil/strdel.c:45: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(s); data/publib-0.40/strutil/strend.c:42: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). return (char *)s + strlen(s); data/publib-0.40/strutil/strendzap.c:46: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/publib-0.40/strutil/strendzap.c:47: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). patlen = strlen(pat); data/publib-0.40/strutil/strgsub.c:49: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). assert(max >= strlen(str)+1); data/publib-0.40/strutil/strgsub.c:54: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). lenpat = strlen(pat); data/publib-0.40/strutil/strgsub.c:55: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). lensub = strlen(sub); data/publib-0.40/strutil/strgsub.c:59: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(str)+1 + n*(lensub-lenpat) > max) data/publib-0.40/strutil/strins.c:45: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). assert(!memoverlap(tgt, strlen(tgt)+strlen(src)+1, src, strlen(src)+1)); data/publib-0.40/strutil/strins.c:45: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). assert(!memoverlap(tgt, strlen(tgt)+strlen(src)+1, src, strlen(src)+1)); data/publib-0.40/strutil/strins.c:45:58: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). assert(!memoverlap(tgt, strlen(tgt)+strlen(src)+1, src, strlen(src)+1)); data/publib-0.40/strutil/strins.c:47: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). srclen = strlen(src); data/publib-0.40/strutil/strins.c:48: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). memmove(tgt + srclen, tgt, strlen(tgt) + 1); /* +1 for '\0' */ data/publib-0.40/strutil/strltrim.c:48: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). memmove(s, t, strlen(t)+1); /* +1 so that '\0' is moved too */ data/publib-0.40/strutil/strmaxcpy.c:43: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). assert(!memoverlap(tgt, n+1, src, strlen(src)+1)); data/publib-0.40/strutil/strmaxcpy.c:46:2: [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. strncat(tgt, src, n); data/publib-0.40/strutil/strmove.c:44:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return memmove(tgt, src, strlen(src) + 1); data/publib-0.40/strutil/strndup.c:47: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/publib-0.40/strutil/strnins.c:45: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). assert(!memoverlap(tgt, strlen(tgt)+strlen(src)+1, src, strlen(src)+1)); data/publib-0.40/strutil/strnins.c:45: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). assert(!memoverlap(tgt, strlen(tgt)+strlen(src)+1, src, strlen(src)+1)); data/publib-0.40/strutil/strnins.c:45:58: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). assert(!memoverlap(tgt, strlen(tgt)+strlen(src)+1, src, strlen(src)+1)); data/publib-0.40/strutil/strnins.c:47: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). srclen = strlen(src); data/publib-0.40/strutil/strnins.c:50: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). memmove(tgt + srclen, tgt, strlen(tgt) + 1); /* +1 for '\0' */ data/publib-0.40/strutil/stroverlap.c:43:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). return memoverlap(s, strlen(s)+1, t, strlen(t)+1); data/publib-0.40/strutil/stroverlap.c:43:39: [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 memoverlap(s, strlen(s)+1, t, strlen(t)+1); data/publib-0.40/strutil/strrev.c:45: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). t = s+strlen(s); data/publib-0.40/strutil/strright.c:44: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(s); data/publib-0.40/strutil/strrstr.c:47: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/publib-0.40/strutil/strrstr.c:48: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). patlen = strlen(pat); data/publib-0.40/strutil/strshuffle.c:44: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 memshuffle(str, 1, strlen(str)); data/publib-0.40/strutil/strsplit.c:53: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). assert(!memoverlap(s, strlen(s)+1, sep, strlen(sep)+1)); data/publib-0.40/strutil/strsplit.c:53: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). assert(!memoverlap(s, strlen(s)+1, sep, strlen(sep)+1)); data/publib-0.40/strutil/strsub.c:52: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). lenstr = strlen(str); data/publib-0.40/strutil/strsub.c:53: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). lenpat = strlen(pat); data/publib-0.40/strutil/strsub.c:54: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). lensub = strlen(sub); data/publib-0.40/strutil/struncstr.c:64: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). assert(!memoverlap(block, max, str, strlen(str)+1)); data/publib-0.40/strutil/struntabify.c:53:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memmove(s+1 + n-1, s+1, strlen(s+1)+1); data/publib-0.40/strutil/strvars.c:161: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 (add_to_end(&r, &size, value, strlen(value) + 1) == -1) data/publib-0.40/strutil/strzap.c:46: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/publib-0.40/strutil/strzap.c:47: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). patlen = strlen(pat); data/publib-0.40/tbuf/test_tbuf.c:79: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). max = strlen(str); ANALYSIS SUMMARY: Hits = 195 Lines analyzed = 14808 in approximately 0.49 seconds (30326 lines/second) Physical Source Lines of Code (SLOC) = 6708 Hits@level = [0] 105 [1] 87 [2] 77 [3] 6 [4] 23 [5] 2 Hits@level+ = [0+] 300 [1+] 195 [2+] 108 [3+] 31 [4+] 25 [5+] 2 Hits/KSLOC@level+ = [0+] 44.7227 [1+] 29.0698 [2+] 16.1002 [3+] 4.62135 [4+] 3.72689 [5+] 0.298151 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.