ecryptfs: Drop redundant NUL terminations after calling ecryptfs_to_hex
PATCH v2 1/1 ecryptfs: Drop redundant NUL terminations after calling ecryptfs_to_hex
ecryptfs_to_hex() already NUL-terminates the destination buffers. Drop the manual NUL terminations.
Signed-off-by Thorsten Blum <[email protected]>
---
Changes in v2:
- Remove all redundant NUL terminations after calling ecryptfs_to_hex
- Link to v1: https://lore.kernel.org/lkml/[email protected]/
--- fs/ecryptfs/debug.c | 1 - fs/ecryptfs/keystore.c | 3 --- 2 files changed, 4 deletions(-)
fs/ecryptfs/debug.c +0 -1
@@ -28,7 +28,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)ecryptfs_printk (KERN_DEBUG ," * passphrase type\n" );ecryptfs_to_hex (salt, auth_tok->token.password.salt,ECRYPTFS_SALT_SIZE ); - salt[ECRYPTFS_SALT_SIZE *2 ] ='\0' ;ecryptfs_printk (KERN_DEBUG ," * salt = [%s]\n" , salt);if (auth_tok->token.password.flags &ECRYPTFS_PERSISTENT_PASSWORD ) {
fs/ecryptfs/keystore.c +0 -3
@@ -908,7 +908,6 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size, (*packet_size) += s->packet_size_len;ecryptfs_to_hex (s->fnek_sig_hex, &data[(*packet_size)],ECRYPTFS_SIG_SIZE ); - s->fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX ] ='\0' ; (*packet_size) +=ECRYPTFS_SIG_SIZE ; s->cipher_code = data[(*packet_size)++]; rc =ecryptfs_cipher_code_to_string (s->cipher_string, s->cipher_code);
@@ -1777,8 +1776,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat, }ecryptfs_to_hex (new_auth_tok->token.password.signature, sig_tmp_space, tag_11_contents_size); - new_auth_tok->token.password.signature[ -ECRYPTFS_PASSWORD_SIG_SIZE ] ='\0' ; crypt_stat->flags |=ECRYPTFS_ENCRYPTED ;break ;case ECRYPTFS_TAG_1_PACKET_TYPE :
Signature · 1 line
2.51.1
Quoted 4 lines · Thorsten Blum
ecryptfs_to_hex()already NUL-terminates the destination buffers. Drop the manual NUL terminations.Signed-off-by Thorsten Blum <[email protected]>
Thanks again for the cleanup!
Acked-by Tyler Hicks <[email protected]>
Tyler
Quoted 45 lines
---
Changes in v2:
- Remove all redundant NUL terminations after callingecryptfs_to_hex
- Link to v1: https://lore.kernel.org/lkml/[email protected]/--- fs/ecryptfs/debug.c | 1 - fs/ecryptfs/keystore.c | 3 --- 2 files changed, 4 deletions(-)fs/ecryptfs/debug.c +0
-1@@ -28,7 +28,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)ecryptfs_printk (KERN_DEBUG ," * passphrase type\n" );ecryptfs_to_hex (salt, auth_tok->token.password.salt,ECRYPTFS_SALT_SIZE ); - salt[ECRYPTFS_SALT_SIZE *2 ] ='\0' ;ecryptfs_printk (KERN_DEBUG ," * salt = [%s]\n" , salt);if (auth_tok->token.password.flags &ECRYPTFS_PERSISTENT_PASSWORD ) {fs/ecryptfs/keystore.c +0
-3@@ -908,7 +908,6 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size, (*packet_size) += s->packet_size_len;ecryptfs_to_hex (s->fnek_sig_hex, &data[(*packet_size)],ECRYPTFS_SIG_SIZE ); - s->fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX ] ='\0' ; (*packet_size) +=ECRYPTFS_SIG_SIZE ; s->cipher_code = data[(*packet_size)++]; rc =ecryptfs_cipher_code_to_string (s->cipher_string, s->cipher_code);@@ -1777,8 +1776,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat, }ecryptfs_to_hex (new_auth_tok->token.password.signature, sig_tmp_space, tag_11_contents_size); - new_auth_tok->token.password.signature[ -ECRYPTFS_PASSWORD_SIG_SIZE ] ='\0' ; crypt_stat->flags |=ECRYPTFS_ENCRYPTED ;break ;case ECRYPTFS_TAG_1_PACKET_TYPE :Signature · 1 line
2.51.1