Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/mft.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer BenAmram <omerbenamram@gmail.com>2020-01-06 23:12:42 +0300
committerGitHub <noreply@github.com>2020-01-06 23:12:42 +0300
commit6f8256e8f4fbc1f11951577712d1595ffaabad44 (patch)
tree36e4f85209ca27b447f188a660e98731d1cb96b8 /src/utils.rs
parent8fc54c4abcdad8ccca1459dd9557996512d49557 (diff)
parent678d4df9663d4bfdd119e0cbf35f556b4414dec3 (diff)
Merge pull request #35 from omerbenamram/housekeeping
Housekeeping
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 25470e7..559c70c 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -43,7 +43,8 @@ pub fn read_utf16_string<T: ReadSeek>(stream: &mut T, len: Option<usize>) -> io:
},
}
- decode_utf16(buffer.into_iter())
+ // We need to stop if we see a NUL byte, even if asked for more bytes.
+ decode_utf16(buffer.into_iter().take_while(|&byte| byte != 0x00))
.map(|r| r.map_err(|_e| io::Error::from(io::ErrorKind::InvalidData)))
.collect()
}