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/libesmtp-1.0.6/base64.c Examining data/libesmtp-1.0.6/protocol-states.h Examining data/libesmtp-1.0.6/htable.c Examining data/libesmtp-1.0.6/message-callbacks.c Examining data/libesmtp-1.0.6/message-source.h Examining data/libesmtp-1.0.6/siobuf.c Examining data/libesmtp-1.0.6/libesmtp-private.h Examining data/libesmtp-1.0.6/acconfig.h Examining data/libesmtp-1.0.6/missing.h Examining data/libesmtp-1.0.6/strdup.c Examining data/libesmtp-1.0.6/rfc2822date.h Examining data/libesmtp-1.0.6/concatenate.h Examining data/libesmtp-1.0.6/smtp-auth.c Examining data/libesmtp-1.0.6/auth-client.h Examining data/libesmtp-1.0.6/htable.h Examining data/libesmtp-1.0.6/snprintf.c Examining data/libesmtp-1.0.6/crammd5/hmacmd5.c Examining data/libesmtp-1.0.6/crammd5/hmacmd5.h Examining data/libesmtp-1.0.6/crammd5/md5.c Examining data/libesmtp-1.0.6/crammd5/md5.h Examining data/libesmtp-1.0.6/crammd5/client-crammd5.c Examining data/libesmtp-1.0.6/ntlm/ntlmdes.c Examining data/libesmtp-1.0.6/ntlm/ntlm.h Examining data/libesmtp-1.0.6/ntlm/client-ntlm.c Examining data/libesmtp-1.0.6/ntlm/ntlmstruct.c Examining data/libesmtp-1.0.6/auth-plugin.h Examining data/libesmtp-1.0.6/smtp-etrn.c Examining data/libesmtp-1.0.6/login/client-login.c Examining data/libesmtp-1.0.6/api.h Examining data/libesmtp-1.0.6/strncasecmp.c Examining data/libesmtp-1.0.6/examples/mail-file.c Examining data/libesmtp-1.0.6/tokens.c Examining data/libesmtp-1.0.6/smtp-api.c Examining data/libesmtp-1.0.6/siobuf.h Examining data/libesmtp-1.0.6/getaddrinfo.c Examining data/libesmtp-1.0.6/errors.c Examining data/libesmtp-1.0.6/gethostbyname.h Examining data/libesmtp-1.0.6/message-source.c Examining data/libesmtp-1.0.6/rfc2822date.c Examining data/libesmtp-1.0.6/base64.h Examining data/libesmtp-1.0.6/tokens.h Examining data/libesmtp-1.0.6/smtp-bdat.c Examining data/libesmtp-1.0.6/gethostbyname.c Examining data/libesmtp-1.0.6/getaddrinfo.h Examining data/libesmtp-1.0.6/protocol.h Examining data/libesmtp-1.0.6/concatenate.c Examining data/libesmtp-1.0.6/headers.h Examining data/libesmtp-1.0.6/protocol.c Examining data/libesmtp-1.0.6/auth-client.c Examining data/libesmtp-1.0.6/strcasecmp.c Examining data/libesmtp-1.0.6/plain/client-plain.c Examining data/libesmtp-1.0.6/memrchr.c Examining data/libesmtp-1.0.6/headers.c Examining data/libesmtp-1.0.6/libesmtp.h Examining data/libesmtp-1.0.6/smtp-tls.c FINAL RESULTS: data/libesmtp-1.0.6/smtp-tls.c:598:9: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (buf, ia5str, sizeof buf - 1); data/libesmtp-1.0.6/smtp-tls.c:638:6: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (buf, (char *) str, sizeof buf - 1); data/libesmtp-1.0.6/auth-client.c:106: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 (buf, prefix); data/libesmtp-1.0.6/auth-client.c:110: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, DLEXT); data/libesmtp-1.0.6/concatenate.c:185:9: [4] (format) vsnprintf: 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. len = vsnprintf (buf, sizeof buf, format, alist); data/libesmtp-1.0.6/concatenate.h:40:26: [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. __attribute__ ((format (printf, 2, 3))) ; data/libesmtp-1.0.6/crammd5/client-crammd5.c:124:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (response, result[0]); data/libesmtp-1.0.6/examples/mail-file.c:397:14: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. result[i] = getpass (prompt); data/libesmtp-1.0.6/examples/mail-file.c:421:8: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. pw = getpass ("certificate password"); data/libesmtp-1.0.6/examples/mail-file.c:425: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 (buf, pw); data/libesmtp-1.0.6/getaddrinfo.c:266:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (sai->ai_canonname, hp->h_name); data/libesmtp-1.0.6/missing.h:48:5: [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 *s, size_t n, const char *format, ...); data/libesmtp-1.0.6/missing.h:54:5: [4] (format) vsnprintf: 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 vsnprintf(char *s, size_t n, const char *format, va_list ap); data/libesmtp-1.0.6/plain/client-plain.c:104:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (plain->buf + 1, result[0]); data/libesmtp-1.0.6/plain/client-plain.c:105:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (plain->buf + strlen (result[0]) + 2, result[1]); data/libesmtp-1.0.6/siobuf.c:640:9: [4] (format) vsnprintf: 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. len = vsnprintf (buf, sizeof buf, format, alist); data/libesmtp-1.0.6/siobuf.h:50:33: [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. __attribute__ ((format (printf, 2, 3))) ; data/libesmtp-1.0.6/snprintf.c:691:5: [4] (format) vsnprintf: 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 vsnprintf (char *str, size_t count, const char *fmt, va_list args) data/libesmtp-1.0.6/snprintf.c:702:5: [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 *str,size_t count,const char *fmt,...) data/libesmtp-1.0.6/snprintf.c:704:5: [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 (va_alist) va_dcl data/libesmtp-1.0.6/snprintf.c:718:10: [4] (format) vsnprintf: 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. (void) vsnprintf(str, count, fmt, ap); data/libesmtp-1.0.6/snprintf.c:769:7: [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 (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); data/libesmtp-1.0.6/snprintf.c:770:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf2, fp_fmt[x], fp_nums[y]); data/libesmtp-1.0.6/snprintf.c:783:7: [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 (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); data/libesmtp-1.0.6/snprintf.c:784:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf2, int_fmt[x], int_nums[y]); data/libesmtp-1.0.6/strdup.c:43:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (p, s1); data/libesmtp-1.0.6/examples/mail-file.c:109:15: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt_long (argc, argv, "dmch:f:s:n:tTv", data/libesmtp-1.0.6/smtp-tls.c:109:10: [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. return getenv ("HOME"); data/libesmtp-1.0.6/base64.c:42: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 index_64[128] = data/libesmtp-1.0.6/concatenate.c:154:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (catbuf->buffer + catbuf->string_length, string, len); data/libesmtp-1.0.6/concatenate.c:179:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/libesmtp-1.0.6/crammd5/client-crammd5.c:104: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 *result[NELT (client_request)]; data/libesmtp-1.0.6/crammd5/client-crammd5.c:105: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 digest[16]; data/libesmtp-1.0.6/crammd5/hmacmd5.c:49: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 ipad[PAD_SIZE]; data/libesmtp-1.0.6/crammd5/hmacmd5.c:50: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 opad[PAD_SIZE]; data/libesmtp-1.0.6/crammd5/hmacmd5.c:51: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 tk[16]; data/libesmtp-1.0.6/crammd5/hmacmd5.c:68: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 (ipad, secret, secret_len); data/libesmtp-1.0.6/crammd5/hmacmd5.c:71: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 (opad, secret, secret_len); data/libesmtp-1.0.6/crammd5/hmacmd5.c:95:57: [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. MD5_CTX *inner, MD5_CTX *outer, unsigned char digest[16]) data/libesmtp-1.0.6/crammd5/hmacmd5.c:97: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 id[16]; data/libesmtp-1.0.6/crammd5/hmacmd5.c:113:13: [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 digest[16]) data/libesmtp-1.0.6/crammd5/hmacmd5.h:45:62: [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. MD5_CTX *inner, MD5_CTX *outer, unsigned char digest[16]); data/libesmtp-1.0.6/crammd5/hmacmd5.h:49:18: [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 digest[16]); data/libesmtp-1.0.6/crammd5/md5.c:41:49: [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 union _endian { unsigned32_t i; unsigned char b[4]; } *_endian = (union _endian *)&_ie; data/libesmtp-1.0.6/crammd5/md5.c:116: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 (p, ucbuf, len); data/libesmtp-1.0.6/crammd5/md5.c:119: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, ucbuf, t); data/libesmtp-1.0.6/crammd5/md5.c:129:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ctx->in, ucbuf, 64); data/libesmtp-1.0.6/crammd5/md5.c:138: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->in, ucbuf, len); data/libesmtp-1.0.6/crammd5/md5.c:154:38: [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. md5_final (MD5Context *ctx, unsigned char digest[16]) data/libesmtp-1.0.6/crammd5/md5.c:194: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 (digest, ctx->buf, 16); data/libesmtp-1.0.6/crammd5/md5.h:41: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 in[64]; data/libesmtp-1.0.6/crammd5/md5.h:48:43: [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. void md5_final (MD5Context *ctx, unsigned char digest[16]); data/libesmtp-1.0.6/errors.c:292: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, text, len); data/libesmtp-1.0.6/examples/mail-file.c:255:18: [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). else if ((fp = fopen (file, "r")) == NULL) data/libesmtp-1.0.6/examples/mail-file.c:280:7: [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[128]; data/libesmtp-1.0.6/examples/mail-file.c:353:4: [2] (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 string. strcpy (p - 1, "\r\n"); data/libesmtp-1.0.6/examples/mail-file.c:385: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 prompt[64]; data/libesmtp-1.0.6/examples/mail-file.c:386:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char resp[512]; data/libesmtp-1.0.6/examples/mail-file.c:400:10: [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). tty = open ("/dev/tty", O_RDWR); data/libesmtp-1.0.6/examples/mail-file.c:585:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/libesmtp-1.0.6/getaddrinfo.c:56: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 (ret, info, sizeof (struct addrinfo)); data/libesmtp-1.0.6/getaddrinfo.c:63: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 (ret->ai_addr, addr, addrlen); data/libesmtp-1.0.6/getaddrinfo.c:217: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 (&((struct sockaddr_in *) &sa)->sin_addr, data/libesmtp-1.0.6/getaddrinfo.c:227: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 (&((struct sockaddr_in6 *) &sa)->sin6_addr, data/libesmtp-1.0.6/headers.c:162:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/libesmtp-1.0.6/headers.c:209:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/libesmtp-1.0.6/htable.c:53:23: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static const unsigned char shuffle[HASHSIZE] = data/libesmtp-1.0.6/htable.c:130:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (node->name, name, namelen); data/libesmtp-1.0.6/login/client-login.c:110: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 *result[NELT (client_request)]; data/libesmtp-1.0.6/ntlm/client-ntlm.c:82: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 *result[NELT (client_request)]; data/libesmtp-1.0.6/ntlm/client-ntlm.c:83:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char host[64]; data/libesmtp-1.0.6/ntlm/client-ntlm.c:84: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[256]; data/libesmtp-1.0.6/ntlm/client-ntlm.c:113: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 nonce[8]; data/libesmtp-1.0.6/ntlm/client-ntlm.c:114: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 lm_resp[24], nt_resp[24]; data/libesmtp-1.0.6/ntlm/ntlmdes.c:37: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 key_56[8]; data/libesmtp-1.0.6/ntlm/ntlmdes.c:44: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 (key_56, secret, len); data/libesmtp-1.0.6/ntlm/ntlmdes.c:90: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 lmpass[14]; data/libesmtp-1.0.6/ntlm/ntlmdes.c:139: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 hash[21]; data/libesmtp-1.0.6/ntlm/ntlmdes.c:142: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 (&nonce, challenge, sizeof nonce); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:70:38: [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. union { unsigned16_t val; unsigned char swap[2]; } u; data/libesmtp-1.0.6/ntlm/ntlmstruct.c:80:42: [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. union u32 { unsigned32_t val; unsigned char swap[4]; } u; data/libesmtp-1.0.6/ntlm/ntlmstruct.c:100: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 + offset, &i16, sizeof i16); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:112: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 + offset, &i32, sizeof i32); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:121: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 (&i16, buf + offset, sizeof i16); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:134: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 (&i32, buf + offset, sizeof i32); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:151:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (buf + *str_offset, data, len); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:191: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 string[256]; data/libesmtp-1.0.6/ntlm/ntlmstruct.c:195: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, NTLMSSP, 8); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:228: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 string[256]; data/libesmtp-1.0.6/ntlm/ntlmstruct.c:233: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, NTLMSSP, 8); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:248: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 + T2NONCE, nonce, 8); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:261: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 string[256]; data/libesmtp-1.0.6/ntlm/ntlmstruct.c:266: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, NTLMSSP, 8); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:328: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 (nonce, buf + T2NONCE, 8); data/libesmtp-1.0.6/plain/client-plain.c:68: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[2 * 255 + 3]; data/libesmtp-1.0.6/plain/client-plain.c:97: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 *result[NELT (client_request)]; data/libesmtp-1.0.6/protocol.c:161:7: [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 host[256]; data/libesmtp-1.0.6/protocol.c:451:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/libesmtp-1.0.6/protocol.c:717: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 token[32]; data/libesmtp-1.0.6/protocol.c:970: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 xtext[256]; data/libesmtp-1.0.6/protocol.c:1111: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 xtext[256]; data/libesmtp-1.0.6/siobuf.c:342: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 (sio->write_position, buf, sio->write_available); data/libesmtp-1.0.6/siobuf.c:352:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (sio->write_position, buf, buflen); data/libesmtp-1.0.6/siobuf.c:572: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. memcpy (buf, sio->read_position, count); data/libesmtp-1.0.6/siobuf.c:634:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[1024]; data/libesmtp-1.0.6/smtp-api.c:559: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, version, sizeof version); data/libesmtp-1.0.6/smtp-auth.c:84:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/libesmtp-1.0.6/smtp-auth.c:147:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[2048]; data/libesmtp-1.0.6/smtp-auth.c:241:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[2048]; data/libesmtp-1.0.6/smtp-tls.c:194:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[2048]; data/libesmtp-1.0.6/smtp-tls.c:195: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[2048]; data/libesmtp-1.0.6/smtp-tls.c:340:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[2048]; data/libesmtp-1.0.6/smtp-tls.c:341: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[2048]; data/libesmtp-1.0.6/smtp-tls.c:573:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[256] = { 0 }; data/libesmtp-1.0.6/smtp-tls.c:668:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[256]; data/libesmtp-1.0.6/snprintf.c:427: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 convert[20]; data/libesmtp-1.0.6/snprintf.c:552: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 iconvert[20]; data/libesmtp-1.0.6/snprintf.c:553: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 fconvert[20]; data/libesmtp-1.0.6/snprintf.c:729: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[LONG_STRING]; data/libesmtp-1.0.6/snprintf.c:730: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[LONG_STRING]; data/libesmtp-1.0.6/tokens.c:41:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char atomchars[256]; data/libesmtp-1.0.6/auth-client.c:103: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 (sizeof prefix + strlen (str) + sizeof DLEXT); data/libesmtp-1.0.6/auth-client.c:429: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). *len = strlen (context->external_id); data/libesmtp-1.0.6/base64.c:71: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). srclen = strlen (src); data/libesmtp-1.0.6/concatenate.c:137: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). len = strlen (string); data/libesmtp-1.0.6/crammd5/client-crammd5.c:121:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). hmac_md5 (challenge, *len, result[1], strlen (result[1]), digest); data/libesmtp-1.0.6/crammd5/client-crammd5.c:122: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). response_len = strlen (result[0]) + 1 + 2 * sizeof digest; data/libesmtp-1.0.6/crammd5/client-crammd5.c:125:7: [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 (response, " "); data/libesmtp-1.0.6/errors.c:288:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (text); data/libesmtp-1.0.6/examples/mail-file.c:402:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read (tty, rp, sizeof resp - (rp - resp)); data/libesmtp-1.0.6/examples/mail-file.c:422: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 (pw); data/libesmtp-1.0.6/getaddrinfo.c:259: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). sai->ai_canonname = malloc (strlen (hp->h_name) + 1); data/libesmtp-1.0.6/headers.c:608: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). len = strlen (name); data/libesmtp-1.0.6/htable.c:118: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). namelen = strlen (name); data/libesmtp-1.0.6/htable.c:148: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). hv = hashi (node->name, strlen (node->name)); data/libesmtp-1.0.6/htable.c:173: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). namelen = strlen (name); data/libesmtp-1.0.6/login/client-login.c:119: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). login->user_len = strlen (login->user); data/libesmtp-1.0.6/login/client-login.c:121: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). login->pass_len = strlen (login->pass); data/libesmtp-1.0.6/message-callbacks.c:76: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). state->length = strlen (string); data/libesmtp-1.0.6/ntlm/ntlmdes.c:41: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 (secret); data/libesmtp-1.0.6/ntlm/ntlmdes.c:75: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). if ((len = strlen (src)) > dstlen) data/libesmtp-1.0.6/ntlm/ntlmdes.c:121: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 (pass); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:202:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (domain); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:212:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (workstation); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:239:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (domain); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:274:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (domain); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:286:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (user); data/libesmtp-1.0.6/ntlm/ntlmstruct.c:298:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (workstation); data/libesmtp-1.0.6/plain/client-plain.c:105: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). strcpy (plain->buf + strlen (result[0]) + 2, result[1]); data/libesmtp-1.0.6/plain/client-plain.c:106: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). *len = strlen (result[0]) + strlen (result[1]) + 2; data/libesmtp-1.0.6/plain/client-plain.c:106: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). *len = strlen (result[0]) + strlen (result[1]) + 2; data/libesmtp-1.0.6/siobuf.c:334: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). buflen = strlen (buf); data/libesmtp-1.0.6/siobuf.c:502:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read (sio->sdr, buf, len)) < 0) data/libesmtp-1.0.6/smtp-tls.c:592: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). if (strlen (ia5str) == ia5len data/libesmtp-1.0.6/smtp-tls.c:632: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 (strlen ((char *) str) == len data/libesmtp-1.0.6/snprintf.c:695: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(str)); data/libesmtp-1.0.6/snprintf.c:720: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(str)); data/libesmtp-1.0.6/strdup.c:41: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). p = malloc (strlen (s1) + 1); ANALYSIS SUMMARY: Hits = 158 Lines analyzed = 12412 in approximately 0.33 seconds (37338 lines/second) Physical Source Lines of Code (SLOC) = 8368 Hits@level = [0] 20 [1] 37 [2] 93 [3] 2 [4] 24 [5] 2 Hits@level+ = [0+] 178 [1+] 158 [2+] 121 [3+] 28 [4+] 26 [5+] 2 Hits/KSLOC@level+ = [0+] 21.2715 [1+] 18.8815 [2+] 14.4598 [3+] 3.34608 [4+] 3.10707 [5+] 0.239006 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.