Skip to content

Commit 7762e23

Browse files
Roberto SassuTyler Hicks
authored andcommitted
eCryptfs: modified size of keysig in the ecryptfs_key_sig structure
The size of the 'keysig' array is incremented of one byte in order to make room for the NULL character. The 'keysig' variable is used, in the function ecryptfs_generate_key_packet_set(), to find an authentication token with the given signature and is printed a debug message if it cannot be retrieved. Signed-off-by: Roberto Sassu <roberto.sassu@polito.it> Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
1 parent cf35ca6 commit 7762e23

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/ecryptfs/ecryptfs_kernel.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ ecryptfs_get_key_payload_data(struct key *key)
233233

234234
struct ecryptfs_key_sig {
235235
struct list_head crypt_stat_list;
236-
char keysig[ECRYPTFS_SIG_SIZE_HEX];
236+
char keysig[ECRYPTFS_SIG_SIZE_HEX + 1];
237237
};
238238

239239
struct ecryptfs_filename {

‎fs/ecryptfs/keystore.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,7 @@ int ecryptfs_add_keysig(struct ecryptfs_crypt_stat *crypt_stat, char *sig)
24252425
return -ENOMEM;
24262426
}
24272427
memcpy(new_key_sig->keysig, sig, ECRYPTFS_SIG_SIZE_HEX);
2428+
new_key_sig->keysig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
24282429
/* Caller must hold keysig_list_mutex */
24292430
list_add(&new_key_sig->crypt_stat_list, &crypt_stat->keysig_list);
24302431

0 commit comments

Comments
 (0)