listxattr: fix space calculation leading to assertion failuremaster
commite38a671e7347d5ef10965bd12720b40a1e94ab98
authorEric Wong <normalperson@yhbt.net>
Wed, 24 Oct 2012 20:11:43 +0000 (24 20:11 +0000)
committerEric Wong <normalperson@yhbt.net>
Wed, 24 Oct 2012 20:25:37 +0000 (24 20:25 +0000)
treebf74dfe73540723c0490e40e343c6c0b29e85fd7
parent9753a633011caf66ce1f7f8a633c7e42df8fb152
listxattr: fix space calculation leading to assertion failure

listxattr_iterator():

* out-of-space calculation should use "n" to determine the bump
  in l->size for reporting future space usage.

dav_listxattr():

* there is no need to subtract one byte from size when setting
  l.space, snprintf() already accounts for the terminating
  null-byte in its buffer and size arguments.

* snprintf() will already null-terminate as will
  "memcpy(l.list, MIME_XATTR, sizeof(MIME_XATTR))",
  so there is no need to explicitly terminate l.list.

* There is no need to add one byte to l.size in the return
  value, all of the previous space/buffer calculations account
  for the trailing null byte.

This is a possible fix for http://bugs.debian.org/514330
(fusedav: Fails to copy remote).  However, I needed "cp -a"
instead of plain "cp" to replicate the issue.
src/fusedav.c