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.
This commit is contained in:
Eugene Syromyatnikov 2017-01-01 22:26:30 +03:00 committed by Dmitry V. Levin
parent 426b63f3fa
commit 0fbbe358ee

6
loop.c
View File

@ -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))