Date: Tue, 9 Dec 2014 22:41:30 -0500 (EST) From: Rick Macklem <rmacklem@uoguelph.ca> To: FreeBSD Filesystems <freebsd-fs@freebsd.org> Cc: George Neville-Neil <gnn@freebsd.org> Subject: fuse dirent bug??? Message-ID: <156074187.8997064.1418182890206.JavaMail.root@uoguelph.ca>
next in thread | raw e-mail | index | archive | help
Hi, While looking at the fuse code to change it to use a new "struct dirent", I spotted this line, which doesn't look correct. Line 358 of sys/fs/fuse/fuse_internal.c: ((char *)cookediov->base)[bytesavail] = '\0'; - I think this is intended to null terminate the name, since it comes right after the memcpy() of the file name. However, bytesavail is the value returned by GENERIC_DIRSIZ(), which means [bytesavail] after "cookediov->base" would be the first byte after the "struct dirent" (including the space for null termination and padding. If I'm correct, I think this line can be replaced by: de->d_name[fudge->namelen] = '\0'; which would be the byte after the name in the structure. Also, although I think the first argument to the memcpy() call just above this is correct, it is complex/convoluted. Wouldn't just writing "memcpy(de->d_name, ..." make it more readable? Anyone out there familiar with fuse able to look at/test this? Thanks, rick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?156074187.8997064.1418182890206.JavaMail.root>