Skip to content

Commit a9e9d71

Browse files
committed
Fixed some of compilation warnings
1 parent 7d78a77 commit a9e9d71

7 files changed

Lines changed: 29 additions & 17 deletions

File tree

src/arg_parser.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const argument_t* arg_init_arg(arg_type type, const char* key, const char* descr
6060
if (key == NULL || description == NULL)
6161
{
6262
errno = EINVAL;
63-
return arg_invalid_arg;
63+
return NULL;
6464
}
6565

6666
argument_t* arg_ptr = malloc_check(arg_ptr, sizeof(argument_t), NULL);
@@ -118,7 +118,7 @@ argument_t *arg_get(const char *key, arg_parser_t *parser_ptr)
118118
if (key == NULL || parser_ptr == NULL)
119119
{
120120
errno = EINVAL;
121-
return arg_invalid_arg;
121+
return NULL;
122122
}
123123

124124
return ht_get_elem(key, parser_ptr->arguments);
@@ -127,7 +127,7 @@ argument_t *arg_get(const char *key, arg_parser_t *parser_ptr)
127127
int arg_parse(int argc, const char **argv, arg_parser_t *parser_ptr)
128128
{
129129
// Validating parameters
130-
if (argc == 0 || argc == NULL || parser_ptr == NULL)
130+
if (argc == 0 || argv == NULL || parser_ptr == NULL)
131131
{
132132
errno = EINVAL;
133133
return arg_invalid_arg;

src/crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ uint8_t* get_md5(const char* data, size_t data_size)
5757
return raw_hash;
5858
}
5959

60-
int rc4_encrypt(const uint8_t* data, size_t data_len, uint8_t* key, uint8_t* enc_data)
60+
int rc4_encrypt(const uint8_t* data, int data_len, uint8_t* key, uint8_t* enc_data)
6161
{
6262
// Loading legacy algorithms provider
6363
OSSL_PROVIDER* legacy = OSSL_PROVIDER_load(NULL, "legacy");

src/crypto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
uint8_t* get_md5(const char* data, size_t data_size);
4444

4545
// Encrypts RC4
46-
int rc4_encrypt(const uint8_t* data, size_t data_len, uint8_t* key, uint8_t* enc_data);
46+
int rc4_encrypt(const uint8_t* data, int data_len, uint8_t* key, uint8_t* enc_data);
4747

4848
// Decryps AES 128 CBC
4949
int aes_128_cbc_decrypt(

src/dump_hashes.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int dump_users_keys(FILE* sam_hive, named_key_t** users_keys_array, size_t* user
107107
-9, 5,
108108
hive_header_ptr, base_nk_ptr, users_nk_ptr, reg_users_path, hints
109109
);
110-
memset(*users_keys_array, NULL, subkey_list.elements_amount * sizeof(named_key_t));
110+
memset(*users_keys_array, 0, subkey_list.elements_amount * sizeof(named_key_t));
111111
*users_amount = 0;
112112

113113
// Iterate throug all Users subkeys
@@ -303,7 +303,13 @@ int decrypt_ntlm_hash(ntlm_user_t* user_info_ptr, const uint8_t* hashed_bootkey,
303303
return 0;
304304
}
305305

306-
int decrypt_hash(uint8_t* enc_hash, uint8_t* hashed_bootkey, uint8_t* ntlmphrase, ntlm_user_t* user_info_ptr, uint8_t* decrypted_hash)
306+
int decrypt_hash(
307+
const uint8_t* enc_hash,
308+
const uint8_t* hashed_bootkey,
309+
const uint8_t* ntlmphrase,
310+
ntlm_user_t* user_info_ptr,
311+
uint8_t* decrypted_hash
312+
)
307313
{
308314
// Validating parameters
309315
if (enc_hash == NULL || hashed_bootkey == NULL || ntlmphrase == NULL || user_info_ptr == NULL || decrypted_hash == NULL)
@@ -355,7 +361,13 @@ int decrypt_hash(uint8_t* enc_hash, uint8_t* hashed_bootkey, uint8_t* ntlmphrase
355361
return 0;
356362
}
357363

358-
int decrypt_salted_hash(uint8_t* enc_hash, uint8_t* hashed_bootkey, uint8_t* salt, ntlm_user_t* user_info_ptr, uint8_t* decrypted_hash)
364+
int decrypt_salted_hash(
365+
const uint8_t* enc_hash,
366+
const uint8_t* hashed_bootkey,
367+
const uint8_t* salt,
368+
ntlm_user_t* user_info_ptr,
369+
uint8_t* decrypted_hash
370+
)
359371
{
360372
// Validating parameters
361373
if (enc_hash == NULL || hashed_bootkey == NULL || salt == NULL || user_info_ptr == NULL || decrypted_hash == NULL)

src/dump_hashes.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@ int decrypt_ntlm_hash(ntlm_user_t* user_info_ptr, const uint8_t* hashed_bootkey,
6666

6767
// Decrypts non-salted/NTLMv1 hash
6868
int decrypt_hash(
69-
uint8_t* enc_hash,
70-
uint8_t* hashed_bootkey,
71-
uint8_t* ntlmphrase,
69+
const uint8_t* enc_hash,
70+
const uint8_t* hashed_bootkey,
71+
const uint8_t* ntlmphrase,
7272
ntlm_user_t* user_info_ptr,
7373
uint8_t* decrypted_hash
7474
);
7575

7676
// Decrypts salted/NTLMv2 hash
7777
int decrypt_salted_hash(
78-
uint8_t* enc_hash,
79-
uint8_t* hashed_bootkey,
80-
uint8_t* salt,
78+
const uint8_t* enc_hash,
79+
const uint8_t* hashed_bootkey,
80+
const uint8_t* salt,
8181
ntlm_user_t* user_info_ptr,
8282
uint8_t* decrypted_hash
8383
);

src/dump_hives.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int open_hives(FILE** system_hive, FILE** sam_hive)
165165
*sam_hive = fopen(sam_hive_filepath, "rb");
166166
if (*sam_hive == NULL)
167167
{
168-
fclose(system_hive);
168+
fclose(*system_hive);
169169
return -2;
170170
}
171171

src/functional.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ char* get_random_string(size_t length)
3131
if (length == 0)
3232
{
3333
errno = EINVAL;
34-
return -1;
34+
return NULL;
3535
}
3636

3737
// Allocating string
38-
char* str = malloc_check(str, length + 1, -2);
38+
char* str = malloc_check(str, length + 1, NULL);
3939
srand(time(NULL));
4040

4141
// Generating string

0 commit comments

Comments
 (0)