Ignore:
Timestamp:
Jul 4, 2021, 3:54:01 PM (4 years ago)
Author:
pr
Message:

Add offset limit checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1-0/src/helpers/xprf.c

    r391 r451  
    7474
    7575/*
    76  *      Copyright (C) 2000-2011 Ulrich M”ller.
     76 *      Copyright (C) 2000-2021 Ulrich M”ller.
    7777 *      This file is part of the "XWorkplace helpers" source package.
    7878 *      This is free software; you can redistribute it and/or modify
     
    402402 *
    403403 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     404 *@@changed WarpIN V1.0.25 (2021-07-04) [pr]: add limit checking
    404405 */
    405406
     
    432433                                    &cbRead)))
    433434                {
    434                     if (cbRead != fs3.cbFile)
     435                    if (cbRead != fs3.cbFile || cbRead < sizeof(INIFILE_HEADER))
    435436                        arc = ERROR_NO_DATA;
    436437                    else
     
    442443
    443444                            // create-applications loop
    444                             while ((ulAppOfs) && (!arc))
     445                            while ((ulAppOfs) && (ulAppOfs + sizeof(INIFILE_APP) <= cbRead) && (!arc))
    445446                            {
    446447                                // application struct
     
    455456
    456457                                // create-keys loop
    457                                 while ((ulKeysOfs) && (!arc))
     458                                while ((ulKeysOfs) && (ulKeysOfs + sizeof(INIFILE_KEY) <= cbRead) && (!arc))
    458459                                {
    459460                                    PINIFILE_KEY pKey = (PINIFILE_KEY)(pbFileData + ulKeysOfs);
Note: See TracChangeset for help on using the changeset viewer.