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/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.h
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/common.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/common.h
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.h
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.h
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/keyutil.c
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/keyutil.h
Examining data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c

FINAL RESULTS:

data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:234:6:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
	if (chown(socket_name, -1, socket_gid) == -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:239: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(socket_name, 0660) == -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:359:7:  [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(global->socket_name, 0666) == -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:363:7:  [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(global->socket_dir, 0755) == -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:74:2:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	printf (
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:215: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(addr.sun_path, socket_name);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:309:4:  [4] (shell) execl:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
			execl(
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c:57:2:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	printf (
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c:178: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(addr.sun_path, socket_name);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:245:2:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
	sprintf(*serial, OPENPGP_PKCS11_SERIAL, serialpart);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:697:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(buffer, "%s 0", serial);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/common.c:60:3:  [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_stream, format, args);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:109: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 (*p_str, s);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:316:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(global->socket_dir, "%s/%s", socketdir, SOCKET_DIR_TEMPLATE);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:326:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf (global->socket_name, "%s/agent.S", global->socket_dir);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:345: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 (serv_addr.sun_path, global->socket_name);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:647: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 (pin, (char *)pin_read);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:699:2:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	printf (
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:788:4:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
			sprintf (home_dir, "%s%s", HOME_ENV, CONFIG_GPG_HOME+1);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:877:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf (default_config_file, "%s%s", PACKAGE, CONFIG_SUFFIX);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:967:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf (config_file, "%s%c%s", home_dir, CONFIG_PATH_SEPARATOR, default_config_file);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:1057:5:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
				execvp (argv[optind], &(argv[optind]));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:138:16:  [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 ((opt = getopt_long (argc, argv, "v", long_options, NULL)) != -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c:129:16:  [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 ((opt = getopt_long (argc, argv, "v", long_options, NULL)) != -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:134:7:  [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.
	zone=getenv("TZ");
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:305:20:  [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.
	char *socketdir = getenv("GNUPG_PKCS11_SOCKETDIR");
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:307:15:  [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.
		socketdir = getenv("TMPDIR");
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:739:25:  [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.
	const char *HOME_ENV = getenv ("USERPROFILE");
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:741:25:  [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.
	const char *HOME_ENV = getenv ("HOME");
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:745:26:  [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.
	if (home_dir == NULL && getenv ("GNUPGHOME") != NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:746:20:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
		home_dir=strdup (getenv ("GNUPGHOME"));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:881:16:  [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 ((opt = getopt_long (argc, argv, "vqsc", long_options, NULL)) != -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:204:14:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
	if ((null = open("/dev/null", O_RDWR)) == -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:293:4:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
			char uid_string[100];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:301:4:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
			sprintf(uid_string, "%d", peeruid);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c:95: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 buffer[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:563:10:  [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).
		type = atoi(name + strlen (OPENPGP_KEY_NAME_PREFIX));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:695: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 buffer[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1015: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 hash[100] = "";
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1470: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[50];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1597:4:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
			char buffer[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1616:4:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
			char buffer[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1687: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 timestamp[100] = {0};
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1701:5:  [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 (timestamp, "%d", (int)isotime2epoch (p));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1715: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 (timestamp, "%d", (int)time (NULL));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1722:4:  [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).
			atoi(line),
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:74: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 file[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:78: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 line[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:91:12:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
	if ((fp = fopen (file, "r")) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:135:24:  [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).
			config->pin_cache = atoi (strchr (line, ' '));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:45: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[3] = {'\0', '\0', '\0'};
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:127: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 old_zone[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/keyutil.c:296: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 grip[20];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/keyutil.c:308: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 grip[20];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:572: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 cmd[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:621: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 cmd[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:750: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 key_val[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:918:22:  [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).
				global.uid_acl = atoi(optarg);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:1000: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).
			if ((fp_log = fopen (log_file, "a")) != NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:1052:4:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
			char env[1024];
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy-server.c:211: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 (socket_name) + 1 >= sizeof (addr.sun_path)) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c:174: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 (socket_name) + 1 >= sizeof (addr.sun_path)) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd-proxy/gnupg-pkcs11-scd-proxy.c:235:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				if ((n = read(fds[i].fd, peer->buffer + peer->buffer_n, sizeof(peer->buffer) - peer->buffer_n)) == -1) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:230:56:  [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).
	gcry_md_hash_buffer(GCRY_MD_SHA1, digest, serialized, strlen(serialized));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:240: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).
	if ((*serial = malloc(strlen(OPENPGP_PKCS11_SERIAL) + OPENPGP_PKCS11_SERIAL_BYTES * 2 + 1)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:557:51:  [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).
	else if (strncmp (name, OPENPGP_KEY_NAME_PREFIX, strlen (OPENPGP_KEY_NAME_PREFIX))) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:563: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).
		type = atoi(name + strlen (OPENPGP_KEY_NAME_PREFIX));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:935:32:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
			if (!strncmp (p, appendprm, strlen (appendprm))) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:936: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).
				p += strlen (appendprm);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1042: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).
			if (!strncmp (p, hashprm, strlen (hashprm))) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1043: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).
				p += strlen (hashprm);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1467: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).
		error = assuan_send_data(ctx, s, strlen (s));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1472: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).
		error = assuan_send_data(ctx, buf, strlen (buf));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1481: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).
			error = assuan_send_data(ctx, s, strlen (s));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1699:25:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
			if (!strncmp (p, ts, strlen (ts))) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1700: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).
				p += strlen (ts);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/command.c:1714: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 (timestamp) == 0) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:56: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).
	memmove (line, p, strlen (p)+1);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:58: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).
	p = line + strlen (line) - 1;
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:68: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).
	return !strncmp (s, p, strlen (p));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:120: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 (p) > 0) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/dconfig.c:129: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 (p) > 0) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:104: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).
	char *p = (char *)realloc (*p_str, strlen (*p_str)+strlen(s)+1);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:104:53:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	char *p = (char *)realloc (*p_str, strlen (*p_str)+strlen(s)+1);
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/encoding.c:139: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 (old_zone) == 0) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:313: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).
	if ((global->socket_dir = malloc(strlen(socketdir) + strlen(SOCKET_DIR_TEMPLATE) + 100)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:313:55:  [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 ((global->socket_dir = malloc(strlen(socketdir) + strlen(SOCKET_DIR_TEMPLATE) + 100)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:322: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).
	if ((global->socket_name = (char *)malloc (strlen (global->socket_dir) + 100)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:344: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 (global->socket_name) + 1 < sizeof (serv_addr.sun_path));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:435:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					(rc = read (
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:603: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).
		memset (user_read, 0, strlen ((char *)user_read));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:654: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).
		memset (pin_read, 0, strlen ((char *)pin_read));
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:785:34:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
			if ((home_dir=(char *)malloc (strlen (CONFIG_GPG_HOME) + strlen (HOME_ENV))) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:785:61:  [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 ((home_dir=(char *)malloc (strlen (CONFIG_GPG_HOME) + strlen (HOME_ENV))) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:874: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).
	if ((default_config_file = (char *)malloc (strlen (PACKAGE)+strlen (CONFIG_SUFFIX)+1)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:874:62:  [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 ((default_config_file = (char *)malloc (strlen (PACKAGE)+strlen (CONFIG_SUFFIX)+1)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:964: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).
		if ((config_file = (char *)malloc (strlen (home_dir) + strlen (default_config_file)+2)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:964: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).
		if ((config_file = (char *)malloc (strlen (home_dir) + strlen (default_config_file)+2)) == NULL) {
data/gnupg-pkcs11-scd-0.9.2/gnupg-pkcs11-scd/scdaemon.c:1179:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		while (read (0, &c, 1) == -1 && errno == EINTR);

ANALYSIS SUMMARY:

Hits = 99
Lines analyzed = 4905 in approximately 0.23 seconds (21662 lines/second)
Physical Source Lines of Code (SLOC) = 3794
Hits@level = [0]  34 [1]  39 [2]  28 [3]  10 [4]  18 [5]   4
Hits@level+ = [0+] 133 [1+]  99 [2+]  60 [3+]  32 [4+]  22 [5+]   4
Hits/KSLOC@level+ = [0+] 35.0554 [1+] 26.0938 [2+] 15.8144 [3+] 8.43437 [4+] 5.79863 [5+] 1.0543
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.