You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
717 B

  1. commit 47a63d90e71d3e19e0e96052bb8c6b9cb140ecc1
  2. Author: Wayne Davison <wayned@samba.org>
  3. Date: Sun Nov 5 11:33:15 2017 -0800
  4. Enforce trailing \0 when receiving xattr name values.
  5. Fixes bug 13112.
  6. diff --git a/xattrs.c b/xattrs.c
  7. index 68305d7..4867e6f 100644
  8. --- a/xattrs.c
  9. +++ b/xattrs.c
  10. @@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
  11. out_of_memory("receive_xattr");
  12. name = ptr + dget_len + extra_len;
  13. read_buf(f, name, name_len);
  14. + if (name_len < 1 || name[name_len-1] != '\0') {
  15. + rprintf(FERROR, "Invalid xattr name received (missing trailing \\0).\n");
  16. + exit_cleanup(RERR_FILEIO);
  17. + }
  18. if (dget_len == datum_len)
  19. read_buf(f, ptr, dget_len);
  20. else {