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/pesign-0.112/include/libdpe/libdpe.h Examining data/pesign-0.112/include/libdpe/pe.h Examining data/pesign-0.112/libdpe/common.h Examining data/pesign-0.112/libdpe/endian.h Examining data/pesign-0.112/libdpe/libdpe.c Examining data/pesign-0.112/libdpe/libdpe.h Examining data/pesign-0.112/libdpe/pe_addcert.c Examining data/pesign-0.112/libdpe/pe_allocspace.c Examining data/pesign-0.112/libdpe/pe_begin.c Examining data/pesign-0.112/libdpe/pe_end.c Examining data/pesign-0.112/libdpe/pe_error.c Examining data/pesign-0.112/libdpe/pe_getdatadir.c Examining data/pesign-0.112/libdpe/pe_getpehdr.c Examining data/pesign-0.112/libdpe/pe_getscn.c Examining data/pesign-0.112/libdpe/pe_getshdr.c Examining data/pesign-0.112/libdpe/pe_nextscn.c Examining data/pesign-0.112/libdpe/pe_opthdr.c Examining data/pesign-0.112/libdpe/pe_rawfile.c Examining data/pesign-0.112/libdpe/pe_readall.c Examining data/pesign-0.112/libdpe/pe_update.c Examining data/pesign-0.112/libdpe/pe_updatefile.c Examining data/pesign-0.112/libdpe/pe_updatenull.c Examining data/pesign-0.112/src/actions.c Examining data/pesign-0.112/src/actions.h Examining data/pesign-0.112/src/authvar.c Examining data/pesign-0.112/src/authvar.h Examining data/pesign-0.112/src/authvar_context.c Examining data/pesign-0.112/src/authvar_context.h Examining data/pesign-0.112/src/certdb.c Examining data/pesign-0.112/src/certdb.h Examining data/pesign-0.112/src/cms_common.c Examining data/pesign-0.112/src/cms_common.h Examining data/pesign-0.112/src/cms_pe_common.c Examining data/pesign-0.112/src/content_info.c Examining data/pesign-0.112/src/content_info.h Examining data/pesign-0.112/src/content_info_priv.h Examining data/pesign-0.112/src/daemon.c Examining data/pesign-0.112/src/daemon.h Examining data/pesign-0.112/src/efitypes.h Examining data/pesign-0.112/src/endian.h Examining data/pesign-0.112/src/oid.c Examining data/pesign-0.112/src/oid.h Examining data/pesign-0.112/src/password.h Examining data/pesign-0.112/src/pesigcheck.h Examining data/pesign-0.112/src/pesigcheck_context.c Examining data/pesign-0.112/src/pesigcheck_context.h Examining data/pesign-0.112/src/pesign.c Examining data/pesign-0.112/src/pesign.h Examining data/pesign-0.112/src/pesign_context.c Examining data/pesign-0.112/src/pesign_context.h Examining data/pesign-0.112/src/siglist.h Examining data/pesign-0.112/src/signed_data.c Examining data/pesign-0.112/src/signed_data.h Examining data/pesign-0.112/src/signer_info.c Examining data/pesign-0.112/src/signer_info.h Examining data/pesign-0.112/src/ucs2.c Examining data/pesign-0.112/src/ucs2.h Examining data/pesign-0.112/src/util.h Examining data/pesign-0.112/src/varfile.c Examining data/pesign-0.112/src/varfile.h Examining data/pesign-0.112/src/wincert.c Examining data/pesign-0.112/src/wincert.h Examining data/pesign-0.112/src/client.c Examining data/pesign-0.112/src/efikeygen.c Examining data/pesign-0.112/src/efisiglist.c Examining data/pesign-0.112/src/pesigcheck.c Examining data/pesign-0.112/src/password.c Examining data/pesign-0.112/src/siglist.c Examining data/pesign-0.112/util/clearpk.c Examining data/pesign-0.112/util/dumpsb.c Examining data/pesign-0.112/util/sb.h Examining data/pesign-0.112/util/setupsb.c Examining data/pesign-0.112/util/shelliface.h FINAL RESULTS: data/pesign-0.112/src/daemon.c:956:7: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. rc = chmod(SOCKPATH, 0660); data/pesign-0.112/src/authvar.c:166:13: [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. } else if (access(ctx->exportfile, F_OK) == 0) { data/pesign-0.112/src/client.c:62:11: [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. int rc = access(SOCKPATH, R_OK); data/pesign-0.112/src/cms_common.c:127:25: [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, 3, 4))) data/pesign-0.112/src/cms_common.c:135: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. int rc = vfprintf(out, fmt, ap); data/pesign-0.112/src/cms_common.h:61: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, 3, 4))); data/pesign-0.112/src/cms_pe_common.c:68:31: [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. #define dprintf(fmt, args...) printf(fmt, ## args) data/pesign-0.112/src/daemon.c:980:11: [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. int rc = access(SOCKPATH, R_OK); data/pesign-0.112/src/daemon.c:1022:25: [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, 3, 4))) data/pesign-0.112/src/password.c:270:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(prompt, "Enter Password or Pin for \"%s\":", data/pesign-0.112/src/password.c:283:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(prompt, data/pesign-0.112/src/pesign.c:151:6: [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(ctx->outfile, F_OK) == 0 && ctx->force == 0) { data/pesign-0.112/src/pesign.c:238:6: [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(ctx->outsattrs, F_OK) == 0 && ctx->force == 0) { data/pesign-0.112/src/pesign.c:292:6: [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(ctx->outsig, F_OK) == 0 && ctx->force == 0) { data/pesign-0.112/src/pesign.c:322:6: [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(ctx->outkey, F_OK) == 0 && ctx->force == 0) { data/pesign-0.112/src/pesign.c:345:6: [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(ctx->outcert, F_OK) == 0 && ctx->force == 0) { data/pesign-0.112/src/util.h:181: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((char *)str->value, value); data/pesign-0.112/src/client.c:268:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. pin = getenv(envname); data/pesign-0.112/include/libdpe/pe.h:46:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char message[64]; /* message to print */ data/pesign-0.112/include/libdpe/pe.h:234:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[8]; /* name or "/12\0" string tbl offset */ data/pesign-0.112/libdpe/pe_addcert.c:83: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(mem, cert, size); data/pesign-0.112/libdpe/pe_begin.c:175: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 raw[1]; data/pesign-0.112/libdpe/pe_getpehdr.c:27:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dest, pe->state.pe.pehdr, sizeof(*dest)); data/pesign-0.112/libdpe/pe_getshdr.c:35:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. result = memcpy(dst, scn->shdr, sizeof(*dst)); data/pesign-0.112/libdpe/pe_updatefile.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(pe->map_address + offset, mzhdr, sizeof(*mzhdr)); data/pesign-0.112/libdpe/pe_updatefile.c:115: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(pe->map_address + offset, pehdr, sizeof(*pehdr)); data/pesign-0.112/src/actions.c:81: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(newsig, sig, sizeof (*newsig)); data/pesign-0.112/src/actions.c:85:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(newsig->data, sig->data, newsig->len); data/pesign-0.112/src/authvar.c:116:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ctx->valuefd = open(ctx->valuefile, O_RDONLY|O_CLOEXEC); data/pesign-0.112/src/authvar.c:173:18: [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). ctx->exportfd = open(ctx->exportfile, flags, mode); data/pesign-0.112/src/authvar.c:189: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->guid, &guid, sizeof (guid)); data/pesign-0.112/src/authvar_context.c:112: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(ptr, &ctx->guid, sizeof(efi_guid_t)); data/pesign-0.112/src/authvar_context.c:115: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(ptr, &ctx->attr, sizeof(uint32_t)); data/pesign-0.112/src/authvar_context.c:118: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(ptr, &ctx->timestamp, sizeof(efi_time_t)); data/pesign-0.112/src/authvar_context.c:121: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(ptr, ctx->value, ctx->value_size); data/pesign-0.112/src/authvar_context.c:149: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(&authinfo->data, sd_der.data, sd_der.len); data/pesign-0.112/src/authvar_context.c:177: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(ptr, &ctx->attr, sizeof(ctx->attr)); data/pesign-0.112/src/authvar_context.c:182: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(&descriptor->timestamp, &ctx->timestamp, sizeof(efi_time_t)); data/pesign-0.112/src/authvar_context.c:183:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&descriptor->authinfo, ctx->authinfo, ctx->authinfo->hdr.length); data/pesign-0.112/src/authvar_context.c:188: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(ptr, ctx->value, ctx->value_size); data/pesign-0.112/src/certdb.c:46:11: [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). db->fd = open(dbfile, O_RDONLY); data/pesign-0.112/src/certdb.c:95: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((void *)&certlist->SignatureType, &efi_x509, sizeof(efi_guid_t)); data/pesign-0.112/src/certdb.c:101: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((void *)cert->SignatureData, db->map, db->size); data/pesign-0.112/src/client.c:174: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 buffer[1024]; data/pesign-0.112/src/client.c:251:10: [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). pinf = fopen(pinfile, "r"); data/pesign-0.112/src/client.c:405: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[2] = "\0"; data/pesign-0.112/src/client.c:447:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int infd = open(infile, O_RDONLY); data/pesign-0.112/src/client.c:454: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). int outfd = open(outfile, O_RDWR|O_CREAT, 0600); data/pesign-0.112/src/cms_common.c:681: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 timebuf[32]; data/pesign-0.112/src/cms_common.c:807: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(idp, &id, sizeof (id)); data/pesign-0.112/src/cms_common.c:865: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(ss.unicode.data, str, len); data/pesign-0.112/src/cms_common.c:929: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(slp, &sl, sizeof (sl)); data/pesign-0.112/src/cms_common.c:1061: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(cms->newsig.data, sd_der.data, sd_der.len); data/pesign-0.112/src/cms_common.c:1151: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(&tmpl[0], &SeqTemplateHeader, sizeof(*tmpl)); data/pesign-0.112/src/cms_common.c:1155: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(&tmpl[i+1], &SeqTemplateTemplate, sizeof(SEC_ASN1Template)); data/pesign-0.112/src/cms_common.c:1297: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(der->data, tmp.data, tmp.len); data/pesign-0.112/src/cms_common.c:1445: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(&wrapper.oid, &oid->oid, sizeof (ai.oid)); data/pesign-0.112/src/cms_pe_common.c:222: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(tmp_array, hash_base, hash_size); data/pesign-0.112/src/content_info.c:84: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 obsolete[28] = ""; data/pesign-0.112/src/content_info.c:382: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(cip, &ci, sizeof *cip); data/pesign-0.112/src/content_info.c:414: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(cip, &ci, sizeof *cip); data/pesign-0.112/src/daemon.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(resp->errmsg, ctx->errstr, msglen); data/pesign-0.112/src/daemon.c:342: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[2]; data/pesign-0.112/src/daemon.c:751: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 control[1024]; data/pesign-0.112/src/daemon.c:1049:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(PIDFILE, O_WRONLY|O_CREAT|O_TRUNC, 0644); data/pesign-0.112/src/daemon.c:1122:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open("/dev/zero", O_RDONLY); data/pesign-0.112/src/daemon.c:1139:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open("/dev/null", O_WRONLY); data/pesign-0.112/src/efikeygen.c:99: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((void *)cert.sig.data + 1, signature->data, signature->len); data/pesign-0.112/src/efikeygen.c:389: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). int pubfd = open(pubfile, O_RDONLY); data/pesign-0.112/src/efikeygen.c:750: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(cert->serialNumber.data + 1, serial_uuid, data/pesign-0.112/src/efisiglist.c:210: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). infd = open(infile, O_RDONLY); data/pesign-0.112/src/efisiglist.c:221: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). outfd = open(outfile, O_RDWR|O_APPEND|O_CREAT, 0644); data/pesign-0.112/src/efisiglist.c:249:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). certfd = open(certfile, O_RDONLY, 0644); data/pesign-0.112/src/oid.c:96: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(si, &oids[moid].sod.oid, sizeof (*si)); data/pesign-0.112/src/password.c:69: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 phrase[200] = {'\0'}; /* ensure EOF doesn't return junk */ data/pesign-0.112/src/password.c:111:13: [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). input = fopen(consoleName, "r"); data/pesign-0.112/src/password.c:118:14: [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). output = fopen(consoleName, "w"); data/pesign-0.112/src/password.c:251: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 prompt[255]; data/pesign-0.112/src/password.c:307: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[LINE_MAX], *p; data/pesign-0.112/src/pesigcheck.c:46: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). ctx->infd = open(ctx->infile, O_RDONLY|O_CLOEXEC); data/pesign-0.112/src/pesign.c:92: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). ctx->infd = open(ctx->infile, O_RDONLY|O_CLOEXEC); data/pesign-0.112/src/pesign.c:157:15: [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). ctx->outfd = open(ctx->outfile, O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, data/pesign-0.112/src/pesign.c:192:18: [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). ctx->rawsigfd = open(ctx->rawsig, O_RDONLY|O_CLOEXEC); data/pesign-0.112/src/pesign.c:215:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ctx->insattrsfd = open(ctx->insattrs, O_RDONLY|O_CLOEXEC); data/pesign-0.112/src/pesign.c:244:21: [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). ctx->outsattrsfd = open(ctx->outsattrs, data/pesign-0.112/src/pesign.c:269:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ctx->insigfd = open(ctx->insig, O_RDONLY|O_CLOEXEC); data/pesign-0.112/src/pesign.c:298:18: [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). ctx->outsigfd = open(ctx->outsig, O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, data/pesign-0.112/src/pesign.c:328:18: [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). ctx->outkeyfd = open(ctx->outkey, O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, data/pesign-0.112/src/pesign.c:351:19: [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). ctx->outcertfd = open(ctx->outcert, O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, data/pesign-0.112/src/siglist.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(new_sd, sd, sl->SignatureSize); data/pesign-0.112/src/siglist.c:162: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(&sd->SignatureOwner, &owner, sizeof (owner)); data/pesign-0.112/src/siglist.c:163: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(sd->SignatureData, sig, sl->SignatureSize - data/pesign-0.112/src/siglist.c:174: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(sdl, sl->Signatures, count * sl->SignatureSize); data/pesign-0.112/src/siglist.c:220: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(&esl->SignatureType, sl->SignatureType, sizeof(efi_guid_t)); data/pesign-0.112/src/siglist.c:227: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(pos, sl->Signatures[i], sl->SignatureSize); data/pesign-0.112/src/signed_data.c:325: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(sdp, &wrapper, sizeof(*sdp)); data/pesign-0.112/src/signed_data.c:390: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(sdp, &wrapper, sizeof(*sdp)); data/pesign-0.112/src/signer_info.c:209: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(signature->data, tmp.data, tmp.len); data/pesign-0.112/src/signer_info.c:217: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(sigitem, signature, sizeof(*sigitem)); data/pesign-0.112/src/signer_info.c:398: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(sip, &si, sizeof(si)); data/pesign-0.112/src/signer_info.c:444: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(sip, &si, sizeof(si)); data/pesign-0.112/src/ucs2.c:42:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ret, s, len * sizeof (*ret)); data/pesign-0.112/src/varfile.c:100: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(vf->magic, EFIVARS_MAGIC, sizeof(EFIVARS_MAGIC)); data/pesign-0.112/src/varfile.c:136: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(newvop, &vop, sizeof (vop)); data/pesign-0.112/src/wincert.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(&cle->data[0], signatures[i]->data, data/pesign-0.112/src/wincert.c:354: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(signatures[i]->data, data, datalen); data/pesign-0.112/src/actions.c:255: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). rc = write(fd, sig_begin_marker, strlen(sig_begin_marker)); data/pesign-0.112/src/actions.c:262: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). rc = write(fd, ascii, strlen(ascii)); data/pesign-0.112/src/actions.c:269: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). rc = write(fd, sig_end_marker, strlen(sig_end_marker)); data/pesign-0.112/src/actions.c:307: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). base64 += strlen(sig_begin_marker); data/pesign-0.112/src/authvar.c:104: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). ctx->value_size = strlen(ctx->value); data/pesign-0.112/src/authvar_context.c:97: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). buf_len = strlen(ctx->name)*sizeof(efi_char16_t) + sizeof(efi_guid_t) + data/pesign-0.112/src/client.c:80:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). socklen_t len = strlen(addr_un.sun_path) + data/pesign-0.112/src/cms_common.c:447: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(cms->certname) + 1, data/pesign-0.112/src/cms_common.c:633: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). input.len = strlen(str); data/pesign-0.112/src/cms_common.c:1410: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(url), data/pesign-0.112/src/daemon.c:83:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int msglen = ctx->errstr ? strlen(ctx->errstr) + 1 : 0; data/pesign-0.112/src/daemon.c:993:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). socklen_t len = strlen(addr_un.sun_path) + data/pesign-0.112/src/daemon.c:1060: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). rc = write(fd, pidstr, strlen(pidstr)+1); data/pesign-0.112/src/efisiglist.c:240: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). int x = strlen(hash); data/pesign-0.112/src/ucs2.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). size_t size = strlen(s) + 1; data/pesign-0.112/src/util.h:89:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). } while ((i = read(fd, buf + size, 1024)) > 0); data/pesign-0.112/src/util.h:172: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). return sizeof(s->size) + (buffer ? strlen(buffer) : 0) + 1; data/pesign-0.112/src/util.h:179: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). str->size = (value ? strlen(value) : 0) + 1; ANALYSIS SUMMARY: Hits = 124 Lines analyzed = 15379 in approximately 0.37 seconds (42085 lines/second) Physical Source Lines of Code (SLOC) = 11693 Hits@level = [0] 232 [1] 18 [2] 88 [3] 1 [4] 16 [5] 1 Hits@level+ = [0+] 356 [1+] 124 [2+] 106 [3+] 18 [4+] 17 [5+] 1 Hits/KSLOC@level+ = [0+] 30.4456 [1+] 10.6046 [2+] 9.06525 [3+] 1.53938 [4+] 1.45386 [5+] 0.0855213 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.