Ignore:
Timestamp:
Feb 15, 2017, 11:57:06 PM (8 years ago)
Author:
dmik
Message:

rpm: Import version 4.13.0 from vendor.

Source URL: http://ftp.rpm.org/releases/rpm-4.13.x/rpm-4.13.0.tar.bz2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rpm/vendor/current/lib/header.c

    r592 r997  
    195195    entryInfo pe = (entryInfo) pev;
    196196    entryInfo info = iv;
    197     int i;
     197    int i, tsize;
     198    int32_t end = 0;
    198199
    199200    for (i = 0; i < il; i++) {
     
    205206        info->count = ntohl(pe[i].count);
    206207
     208        /* Previous data must not overlap */
     209        if (end > info->offset)
     210            return i;
     211
    207212        if (hdrchkType(info->type))
    208213            return i;
    209214        if (hdrchkAlign(info->type, info->offset))
    210215            return i;
    211         if (hdrchkRange(dl, info->offset))
     216
     217        /* For string types we can only check the array size is sane */
     218        tsize = typeSizes[info->type];
     219        if (tsize < 1)
     220            tsize = 1;
     221
     222        /* Verify the data actually fits */
     223        end = info->offset + (info->count * tsize);
     224        if (hdrchkRange(dl, end))
    212225            return i;
    213         if (hdrchkData(info->count))
    214             return i;
    215 
    216     }
     226    }
     227
    217228    return -1;
    218229}
Note: See TracChangeset for help on using the changeset viewer.