[PATCH] Fix nasty vfs_fruit bug 13646

Ralph Böhme slow at samba.org
Wed Oct 31 19:59:24 UTC 2018

On Wed, Oct 31, 2018 at 12:50:21PM -0700, Jeremy Allison wrote:
>On Wed, Oct 31, 2018 at 08:48:06PM +0100, Ralph Böhme wrote:
>> >
>> > Sorry Ralph but I think that this:
>> >
>> > Subject: [PATCH 36/42] vfs_fruit: prepare fruit_pread_meta() for reading on fake-fd
>> >
>> > is still wrong. In fruit_pread_meta() the requested
>> > amount to be read is size_t n into void *data.
>> >
>> > Inside fruit_pread_meta() we have:
>> >
>> >        to_return = MIN(n, AFP_INFO_SIZE);
>> >
>> > so to_return is now the correct amount to be
>> > returned  - allowing for the fact the caller
>> > might have asked for less than AFP_INFO_SIZE.
>> thanks! Let me check this. Afair this was already the behaviour before the
>> patch and I was too scared it although it look wrong.
>Ah, that behavior was wrong though - I'm guessing
>we never ran accross it as MacOS clients who are
>the only users of this will always ask for AFP_INFO_SIZE
>value or greater - not less.

you were right, return to_return not nread in the new hunk.

The previous behaviour was

  nread = read(..., to_return, ...);
  return nread;

which is ok. But the new hunk does:

  nread = afpinfo_pack(ai, afpinfo_buf);
  memcpy(data, afpinfo_buf, to_return);
  return nread;

here nread will always be 60, so eventually more then the client requested.

Good catch, thanks!


Ralph Boehme, Samba Team       https://samba.org/
Samba Developer, SerNet GmbH   https://sernet.de/en/samba/
GPG Key Fingerprint:           FAE2 C608 8A24 2520 51C5
                               59E4 AA1E 9B71 2639 9E46

More information about the samba-technical mailing list