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/samdump2-3.0.0/bkhive.c Examining data/samdump2-3.0.0/list.h Examining data/samdump2-3.0.0/ntdll.h Examining data/samdump2-3.0.0/dumpsam.c Examining data/samdump2-3.0.0/samdump2.h Examining data/samdump2-3.0.0/hive.c Examining data/samdump2-3.0.0/hive.h Examining data/samdump2-3.0.0/list.c Examining data/samdump2-3.0.0/main.c Examining data/samdump2-3.0.0/samdump2.c FINAL RESULTS: data/samdump2-3.0.0/bkhive.c:46:27: [4] (shell) system: 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. int bkhive(unsigned char *system, unsigned char *pkey, char *error, int debug) { data/samdump2-3.0.0/bkhive.c:75:21: [4] (shell) system: 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. if( _RegOpenHive( system, &h ) ) { data/samdump2-3.0.0/bkhive.c:76:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error, "Error opening hive file %s\n", system ); data/samdump2-3.0.0/bkhive.c:76:52: [4] (shell) system: 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. sprintf(error, "Error opening hive file %s\n", system ); data/samdump2-3.0.0/bkhive.c:94:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(regselect, "%s\\Select", root_key); data/samdump2-3.0.0/bkhive.c:106:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(reglsa,"%s\\ControlSet%03d\\Control\\Lsa\\", root_key, control); data/samdump2-3.0.0/bkhive.c:123:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( keyname, "%s%s", reglsa, kn[i] ); data/samdump2-3.0.0/bkhive.c:131:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error, "Error accessing key %s\nWrong/corrupted hive??\n", kn[i] ); data/samdump2-3.0.0/dumpsam.c:223:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error, "Error reading %s key\n", kn[i]); data/samdump2-3.0.0/samdump2.c:234:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( error, "Error opening sam hive or not valid file(\"%s\")\n", sam ); data/samdump2-3.0.0/samdump2.c:257:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(regaccountkey, "%s\\SAM\\Domains\\Account", root_key); data/samdump2-3.0.0/samdump2.c:258:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(reguserskey, "%s\\SAM\\Domains\\Account\\Users", root_key); data/samdump2-3.0.0/samdump2.c:265:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( error, "%s key!\n", regaccountkey ); data/samdump2-3.0.0/samdump2.c:310: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( keyname, reguserskey ); data/samdump2-3.0.0/samdump2.c:312:5: [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( keyname, (char*)regkeyname ) ; data/samdump2-3.0.0/samdump2.c:382:18: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. buff_len = sprintf(buff, "*disabled* %s:%d:", username_utf8, rid ); data/samdump2-3.0.0/samdump2.c:384:18: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. buff_len = sprintf(buff, "%s:%d:", username_utf8, rid ); data/samdump2-3.0.0/samdump2.h:31:27: [4] (shell) system: 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. int bkhive(unsigned char *system, unsigned char *pkey, char *error, int debug); data/samdump2-3.0.0/dumpsam.c:272:12: [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. windir = getenv("windir"); data/samdump2-3.0.0/main.c:65:15: [3] (buffer) getopt: 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(argc, argv, "hdlo:")) != -1) data/samdump2-3.0.0/bkhive.c:56: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 kv[9]; data/samdump2-3.0.0/bkhive.c:62: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[0x10]; data/samdump2-3.0.0/bkhive.c:84: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(error, "Error reading hive root key\n"); data/samdump2-3.0.0/bkhive.c:111:7: [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(error, "Error reading ControlSet: _RegQueryValue\n"); data/samdump2-3.0.0/bkhive.c:115: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(error, "Error reading ControlSet: _RegOpenKey\n"); data/samdump2-3.0.0/dumpsam.c:145:7: [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(error,"Error with ZwFsControlFile : 0x%x\n", (int)Status); data/samdump2-3.0.0/dumpsam.c:191:7: [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(error, "Error with ZwOpenFile : 0x%x : %d \n", status, (int)RtlNtStatusToDosError(status)); data/samdump2-3.0.0/dumpsam.c:208: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 kv[9]; data/samdump2-3.0.0/dumpsam.c:210: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[16]; data/samdump2-3.0.0/dumpsam.c:211: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 pkeystring[16*2+1] = {0}; data/samdump2-3.0.0/dumpsam.c:239:2: [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(pkeystring+i*2, "%.2x", pkey[i]); data/samdump2-3.0.0/dumpsam.c:242: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(error, "Error reading LSA key\n"); data/samdump2-3.0.0/dumpsam.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 fs[16] ={0}; data/samdump2-3.0.0/dumpsam.c:262: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 filename[MAX_PATH] ={0}; data/samdump2-3.0.0/dumpsam.c:264: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 boot_sector[512]={0}; data/samdump2-3.0.0/dumpsam.c:268: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(error, "Unable to set Debug Privilege. You must be admin to run this program.\n"); data/samdump2-3.0.0/dumpsam.c:282:7: [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(error, "Error with GetVolumeInformationByHandleW : %d \n", (int)GetLastError()); data/samdump2-3.0.0/dumpsam.c:294: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(error, "This tool works only on NTFS or FAT32 volumes\n"); data/samdump2-3.0.0/dumpsam.c:304: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(error, "Error with CreateFile: %d\n", (int)GetLastError()); data/samdump2-3.0.0/dumpsam.c:311: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(error, "Error with ReadFile: %d\n", (int)GetLastError()); data/samdump2-3.0.0/dumpsam.c:352: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(error, "Error with ReadFile: %d\n", (int)GetLastError()); data/samdump2-3.0.0/hive.c:43: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(nk, h->base+offset+4, sizeof(nk_hdr)); data/samdump2-3.0.0/hive.c:62: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(lf, h->base+offset+4, sizeof(lf_hdr)); data/samdump2-3.0.0/hive.c:73:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(vk, h->base+offset+4, sizeof(vk_hdr)); data/samdump2-3.0.0/hive.c:88: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(value, h->base+offset+4, size*sizeof(int)); data/samdump2-3.0.0/hive.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(hr, pos, sizeof(hashrecord)); data/samdump2-3.0.0/hive.c:130:17: [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( ( hiveh = fopen((char *) filename, "rb" ) ) != NULL ) { data/samdump2-3.0.0/hive.c:162: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(h->base, buffer, size); data/samdump2-3.0.0/hive.c:262: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(*nr, n, sizeof(nk_hdr)); data/samdump2-3.0.0/hive.c:297:8: [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 (*buff, &(v->data_off), (*len)); data/samdump2-3.0.0/hive.c:300:8: [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 (*buff, read_data( h, v->data_off + 0x1000),(*len)); data/samdump2-3.0.0/hive.c:332: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( name, nk->key_name, min( *namelen, nk->name_len ) ); data/samdump2-3.0.0/hive.h:75: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 keyname[4]; data/samdump2-3.0.0/main.c:52: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 pkey[0x10]; data/samdump2-3.0.0/main.c:55: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 error[512]; data/samdump2-3.0.0/main.c:94: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(file, "w"); data/samdump2-3.0.0/main.c:104:26: [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. if (bkhive((unsigned char *)argv[argc-2], pkey, error, debug) == -1) { data/samdump2-3.0.0/main.c:109:28: [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. if (samdump2((unsigned char *)argv[argc-1], hash_list, pkey, error, debug, live, 0) == -1) { data/samdump2-3.0.0/samdump2.c:82:45: [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 sid_to_key1(unsigned long sid,unsigned char deskey[8]) data/samdump2-3.0.0/samdump2.c:84: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 s[7]; data/samdump2-3.0.0/samdump2.c:101:45: [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 sid_to_key2(unsigned long sid,unsigned char deskey[8]) data/samdump2-3.0.0/samdump2.c:103: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 s[7]; data/samdump2-3.0.0/samdump2.c:202: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 regkeyname[50]; data/samdump2-3.0.0/samdump2.c:208: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 md5hash[0x10]; data/samdump2-3.0.0/samdump2.c:210: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 hbootkey[0x20]; data/samdump2-3.0.0/samdump2.c:225: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 obfkey[0x10]; data/samdump2-3.0.0/samdump2.c:226: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 fb[0x10]; data/samdump2-3.0.0/samdump2.c:239:7: [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( error, "Error opening sam hive, hive not valid\n"); data/samdump2-3.0.0/samdump2.c:248: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( error, "Error reading hive root key\n"); data/samdump2-3.0.0/samdump2.c:271: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( error, "No F!\n" ); data/samdump2-3.0.0/samdump2.c:292:7: [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( error, "No Users key!\n" ); data/samdump2-3.0.0/samdump2.c:320:7: [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( error, "Asd -_- _RegEnumKey fail!\n" ); data/samdump2-3.0.0/samdump2.c:327:7: [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( error, "No F value!\n" ); data/samdump2-3.0.0/samdump2.c:339:7: [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( error, "No V value!\n" ); data/samdump2-3.0.0/samdump2.c:437:2: [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(buff+buff_len, "%.2x", fb[i] ); data/samdump2-3.0.0/samdump2.c:441:7: [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(buff+buff_len, "aad3b435b51404eeaad3b435b51404ee" ); data/samdump2-3.0.0/samdump2.c:490:2: [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(buff+buff_len, "%.2x", fb[i] ); data/samdump2-3.0.0/samdump2.c:494:7: [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(buff+buff_len, "31d6cfe0d16ae931b73c59d7e0c089c0"); data/samdump2-3.0.0/samdump2.c:497: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(buff+buff_len, ":::" ); data/samdump2-3.0.0/bkhive.c:91:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). regselect = (char *) malloc(strlen(root_key)+10); data/samdump2-3.0.0/bkhive.c:92: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). reglsa = (char *) malloc(strlen(root_key)+33); data/samdump2-3.0.0/bkhive.c:122: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). keyname = (char *) malloc( strlen( reglsa ) + strlen( kn[i] ) + 1 ); data/samdump2-3.0.0/bkhive.c:122: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). keyname = (char *) malloc( strlen( reglsa ) + strlen( kn[i] ) + 1 ); data/samdump2-3.0.0/dumpsam.c:173:41: [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). fullpath = (unsigned char *) malloc(5+strlen(path)); data/samdump2-3.0.0/dumpsam.c:174: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(fullpath, 0, 5+strlen(path)); data/samdump2-3.0.0/dumpsam.c:175:43: [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). fullpathunicode = (wchar_t *) malloc((5+strlen(path))*sizeof(wchar_t)); data/samdump2-3.0.0/dumpsam.c:176:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(fullpath, "\\??\\", 4); data/samdump2-3.0.0/dumpsam.c:177:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(fullpath+4, path, strlen(path)); data/samdump2-3.0.0/dumpsam.c:177: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). strncpy(fullpath+4, path, strlen(path)); data/samdump2-3.0.0/dumpsam.c:180:39: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). mbstowcs(fullpathunicode, fullpath, strlen(fullpath)); data/samdump2-3.0.0/dumpsam.c:181: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). fullpathunicode[strlen(fullpath)] = 0; data/samdump2-3.0.0/dumpsam.c:273:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(drive, windir, 1); data/samdump2-3.0.0/dumpsam.c:274:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(devicename+4, windir, 1); data/samdump2-3.0.0/dumpsam.c:275:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, windir, strlen(windir)); data/samdump2-3.0.0/dumpsam.c:275: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). strncpy(filename, windir, strlen(windir)); data/samdump2-3.0.0/dumpsam.c:276:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(filename,"\\SYSTEM32\\CONFIG\\SAM", 20); data/samdump2-3.0.0/hive.c:196:52: [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( !memcmp( t, n->key_name, n->name_len ) && (strlen(t) == n->name_len)) { data/samdump2-3.0.0/hive.c:220:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(*root_key, (char*)n->key_name, n->name_len); data/samdump2-3.0.0/hive.c:288:39: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( !memcmp( name, v->value_name, strlen( name ) ) || (name == NULL && ( v->flag & 1 ) == 0 ) ) { data/samdump2-3.0.0/samdump2.c:254: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). regaccountkey = (char *) malloc(strlen(root_key)+30); data/samdump2-3.0.0/samdump2.c:255: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). reguserskey = (char *) malloc(strlen(root_key)+30); data/samdump2-3.0.0/samdump2.c:307:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). keyname = (char*) malloc( strlen( reguserskey ) + regkeynamelen + 2 ); data/samdump2-3.0.0/samdump2.c:311:5: [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( keyname, "\\" ) ; data/samdump2-3.0.0/samdump2.c:444:5: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buff+buff_len, ":" ); ANALYSIS SUMMARY: Hits = 104 Lines analyzed = 3758 in approximately 0.09 seconds (41567 lines/second) Physical Source Lines of Code (SLOC) = 2906 Hits@level = [0] 75 [1] 25 [2] 59 [3] 2 [4] 18 [5] 0 Hits@level+ = [0+] 179 [1+] 104 [2+] 79 [3+] 20 [4+] 18 [5+] 0 Hits/KSLOC@level+ = [0+] 61.5967 [1+] 35.788 [2+] 27.1851 [3+] 6.88231 [4+] 6.19408 [5+] 0 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.