HavocFramework / Havoc

The Havoc Framework.
GNU General Public License v3.0
6.31k stars 903 forks source link

Iterate to next non-null dowloand item instead of breaking for loop #430

Closed youngifif closed 7 months ago

youngifif commented 7 months ago

A logic bug is detailed in comment as follows:

    for ( ;; )
    {
        if ( ! Download )
            break;

        if ( Download->State == DOWNLOAD_STATE_REMOVE )
        {
            /* we are at the beginning. */
            if ( ! DownLast )
            {
                Instance.Downloads = Download->Next;
                DownloadFree( Download );
                Download = NULL;
            }
            else
            {
                DownLast->Next = Download->Next;
                DownloadFree( Download );//  `Download`  will be set to null,and then break the for-loop.Fixing 
                DownLast = NULL;
            }
        }
        else
        {
            DownLast = Download;
            Download = Download->Next;
        }
    }
Cracked5pider commented 7 months ago

make a pull request towards dev and not main.