From 9d36c91070aabf509d66ebd8d3c47f30611b3df0 Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Thu, 10 Sep 2026 12:23:09 +0200 Subject: [PATCH] fix(tape): terminate the LTFS signature in the volume coherency attribute strncpy copies cnt bytes and only terminates when cnt exceeds the source length, so the reader's check for "LTFS\0" saw an uninitialised byte. --- src/libltfs/tape.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libltfs/tape.c b/src/libltfs/tape.c index 255ca2a2..c4fad3dc 100644 --- a/src/libltfs/tape.c +++ b/src/libltfs/tape.c @@ -1783,7 +1783,7 @@ int tape_set_cart_coherency(struct device_data *dev, const tape_partition_t part coh_data[30] = 0; /* Size of APPLICATION CLIENT SPECIFIC INFORMATION (Byte 1) */ coh_data[31] = 43; /* Size of APPLICATION CLIENT SPECIFIC INFORMATION (Byte 0) */ /* Size of the buffer to insert 'LTFS' needs to be size of 5 for the 4 letters and the null terminator*/ - arch_strncpy((char *)coh_data + 32,"LTFS", 5, 4); + arch_strncpy((char *)coh_data + 32,"LTFS", 5, 5); memcpy(coh_data + 37, coh->uuid, 37); /* Version field