]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
encoding: fix iterator use for struct_len copy_in
authorSage Weil <sage.weil@dreamhost.com>
Mon, 9 Apr 2012 18:25:41 +0000 (11:25 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Mon, 9 Apr 2012 19:08:19 +0000 (12:08 -0700)
The end() iterator position does not record an offset when the list is
modified.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/encoding.h

index e9bf1e9260113f8d125ce7ec6a5cac8e8b25e0eb..7e5bb3a476f490fd6ea9c01159735e5fab36ac49 100644 (file)
@@ -656,8 +656,9 @@ inline void decode(std::deque<T>& ls, bufferlist::iterator& p)
   ::encode(struct_v, bl);                                   \
   ::encode(struct_compat, bl);                              \
   __le32 struct_len = 0;                                    \
-  buffer::list::iterator struct_len_it = bl.end();          \
   ::encode(struct_len, bl);                                 \
+  buffer::list::iterator struct_len_it = bl.end();          \
+  struct_len_it.advance(-4);                                \
   do {
 
 /**