chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c3e7817
)
parse_slice_hex: Fix to properly handle odd-length slices
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 19:09:35 +0000
(20:09 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 19:09:35 +0000
(20:09 +0100)
Previously it would accept some of them, and parse them in a weird
way. I don't think this is actually important.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/utils.rs
patch
|
blob
|
history
diff --git
a/src/utils.rs
b/src/utils.rs
index 310d0772e75e1858a2525d739dde20b5884a591d..cfaafb3705fa747d593ed6f1dd734d1703506c7d 100644
(file)
--- a/
src/utils.rs
+++ b/
src/utils.rs
@@
-716,7
+716,7
@@
pub fn fmt_hex(f: &mut Formatter, buf: &[u8]) {
#[must_use]
pub fn parse_slice_hex(s: &str, buf: &mut [u8]) -> usize {
let l = s.len();
- if l %
1
!= 0 { throw!() }
+ if l %
2
!= 0 { throw!() }
let l = l/2;
if l > buf.len() { throw!() }