From 0fbbe358eebd18e44c5c4c849596b600f3a0a795 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Sun, 1 Jan 2017 22:26:30 +0300 Subject: [PATCH] loop: fix lo_encrypt_key field output lo_encrypt_key is a sized string with its size specified by lo_encrypt_key_size field, so take lo_encrypt_key_size into account. * loop.c (decode_loop_info, decode_loop_info64): Use minimum of LO_KEY_SIZE and lo_encrypt_key_size field value as lo_encrypt_key size. --- loop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/loop.c b/loop.c index 50b9b3e4..20e080ff 100644 --- a/loop.c +++ b/loop.c @@ -82,7 +82,8 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr) if (!abbrev(tcp) || info.lo_encrypt_type != LO_CRYPT_NONE) { tprints(", lo_encrypt_key="); print_quoted_string((void *) info.lo_encrypt_key, - LO_KEY_SIZE, 0); + MIN((uint32_t) info.lo_encrypt_key_size, + LO_KEY_SIZE), 0); } if (!abbrev(tcp)) @@ -143,7 +144,8 @@ decode_loop_info64(struct tcb *const tcp, const kernel_ulong_t addr) LO_NAME_SIZE, QUOTE_0_TERMINATED); tprints(", lo_encrypt_key="); print_quoted_string((void *) info64.lo_encrypt_key, - LO_KEY_SIZE, 0); + MIN(info64.lo_encrypt_key_size, + LO_KEY_SIZE), 0); } if (!abbrev(tcp)) -- 2.40.0