vfs_fruit: fix unpacking of AppleDouble files
authorRalph Boehme <rb@sernet.de>
Sat, 30 Aug 2014 08:24:05 +0000 (10:24 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 25 Sep 2014 19:19:12 +0000 (21:19 +0200)
OS X AppleDouble files may contain a FinderInfo AppleDouble entry
larger then 32 bytes containing additional packed xattrs. ad_unpack()
must deal with this in a way that allows callers to possibly fixup
the entry.

Signed-off-by: Ralph Boehme <rb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_fruit.c

index 1226dc0e7538c556f5b47228bdd91700150cabf6..bdb068a7e2605a75497131692c1f0b633156e6f5 100644 (file)
@@ -596,12 +596,14 @@ static bool ad_unpack(struct adouble *ad, const int nentries)
                        return false;
                }
 
-               if (off > bufsize) {
+               if ((off > bufsize) && (eid != ADEID_RFORK)) {
                        DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n",
                                  eid, off, len));
                        return false;
                }
-               if ((eid != ADEID_RFORK) && ((off + len) > bufsize)) {
+               if ((eid != ADEID_RFORK) &&
+                   (eid != ADEID_FINDERI) &&
+                   ((off + len) > bufsize)) {
                        DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n",
                                  eid, off, len));
                        return false;