From 0b378fd177be700f0cb47a653295d70c2fe45a9d Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Mon, 8 Feb 2016 18:32:24 +0100 Subject: [PATCH] ntfslabel.c: Fix incorrect label buffer being NULL-terminated. The UTF-16LE label buffer containing the result of mbs2ucs is the one that should be NULL-terminated when the label is longer than permitted. Not the input buffer, which is a function parameter assumed to be NULL-terminated anyway. --- ntfsprogs/ntfslabel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 77a34f08..e2d36c8e 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -389,7 +389,7 @@ static int change_label(ntfs_volume *vol, char *label) (unsigned)(label_len - (0x100 / sizeof(ntfschar)))); label_len = 0x100 / sizeof(ntfschar); - label[label_len] = 0; + new_label[label_len] = const_cpu_to_le16(0); } if(!opts.noaction) -- 2.11.0