Commit b09734b1 authored by Tommi Virtanen's avatar Tommi Virtanen Committed by Sage Weil

libceph: Fix base64-decoding when input ends in newline.

It used to return -EINVAL because it thought the end was not aligned
to 4 bytes.

Clean up superfluous src < end test in if, the while itself guarantees
that.
Signed-off-by: default avatarTommi Virtanen <tommi.virtanen@dreamhost.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 521cb40b
...@@ -78,8 +78,10 @@ int ceph_unarmor(char *dst, const char *src, const char *end) ...@@ -78,8 +78,10 @@ int ceph_unarmor(char *dst, const char *src, const char *end)
while (src < end) { while (src < end) {
int a, b, c, d; int a, b, c, d;
if (src < end && src[0] == '\n') if (src[0] == '\n') {
src++; src++;
continue;
}
if (src + 4 > end) if (src + 4 > end)
return -EINVAL; return -EINVAL;
a = decode_bits(src[0]); a = decode_bits(src[0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment