s3:vfs: Do not overrun array ad->ad_eid
authorAndreas Schneider <asn@samba.org>
Fri, 25 Aug 2017 12:45:29 +0000 (14:45 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 25 Aug 2017 18:05:32 +0000 (20:05 +0200)
The array is defined as:
    struct ad_entry ad_eid[ADEID_MAX]

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Aug 25 20:05:32 CEST 2017 on sn-devel-144

source3/modules/vfs_fruit.c

index 09e0fcdc3c9fb0d5d29c88f892216d80666ccc1a..3ba59967482ba2686ae513e3256d7e2e22c7e167 100644 (file)
@@ -653,7 +653,7 @@ static bool ad_unpack(struct adouble *ad, const size_t nentries,
                off = RIVAL(ad->ad_data, AD_HEADER_LEN + (i * AD_ENTRY_LEN) + 4);
                len = RIVAL(ad->ad_data, AD_HEADER_LEN + (i * AD_ENTRY_LEN) + 8);
 
-               if (!eid || eid > ADEID_MAX) {
+               if (!eid || eid >= ADEID_MAX) {
                        DEBUG(1, ("bogus eid %d\n", eid));
                        return false;
                }