aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-03 16:01:18 -0500
committerSage Weil <sage@inktank.com>2012-07-30 09:29:55 -0700
commitc61a1abd215c1ccd6fa73104c79e79987ed3aa98 (patch)
treebd3e97181584049386a85f338623b76cf5d83952
parent8842b3be96c376f174ae0d4f282d14728ad5febf (diff)
libceph: fix off-by-one bug in ceph_encode_filepath()
There is a BUG_ON() call that doesn't account for the single byte structure version at the start of an encoded filepath in ceph_encode_filepath(). Fix that. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--include/linux/ceph/decode.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index d8615dee580..bcbd66c8489 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -151,7 +151,7 @@ static inline void ceph_encode_filepath(void **p, void *end,
u64 ino, const char *path)
{
u32 len = path ? strlen(path) : 0;
- BUG_ON(*p + sizeof(ino) + sizeof(len) + len > end);
+ BUG_ON(*p + 1 + sizeof(ino) + sizeof(len) + len > end);
ceph_encode_8(p, 1);
ceph_encode_64(p, ino);
ceph_encode_32(p, len);