[Pvfs2-developers] here_string endecode bug?
Michael Moore
mtmoore at clemson.edu
Thu Sep 3 11:51:14 EDT 2009
In looking at some issues I was having with the encoding of PVFS_dirent
structs in requests I saw an inconsistency in how here_strings are
encoded and decoded. encode_string memcpys strings starting at *(pptr)+4
unless it's length 0 in which case it sets *(pptr) to 0. However,
decode_here_string always copys from *(pptr) + 4. So, if d_name is an
empty string when encoded d_name gets 1 byte of *(pptr)+4 instead of 0
on decoding.
The fix is just to handle decoding like encoding. Is there a reason for
always copying to *(pptr)+4 in decode_here_string? Is this something
that should be changed?
Michael
diff -r1.24.24.1 endecode-funcs.h
131c131,134
< memcpy(pbuf, *(pptr) + 4, len + 1); \
---
> > if( len ) \
> > memcpy(pbuf, *(pptr) + 4, len + 1); \
> > else \
> > memcpy(pbuf, *(pptr), len + 1); \
More information about the Pvfs2-developers
mailing list