[PATCH] High priority bugfix for setup.exe

Max Bowsher maxb@ukf.net
Mon Apr 18 10:45:00 GMT 2005


Max Bowsher wrote:
> Dave Korn wrote:
>>  Heh, guess how nicely this:-
>>
>>  virtual void visitFile(String const &basePath, const WIN32_FIND_DATA
>> *theFile)
>>    {
>>      String fileName(theFile->cFileName);
>>      if (fileName.substr(fileName.size() - 5) == ".done")
>>        return;
>>
>> bit of code plays with the file /etc/postinstall/d.sh?  (Hint: fileName 
>> ==
>> "d.sh")
>>
>>  The attached patch fixes the access violation that results from substr
>> indexing off the front of the string.  It builds and fixes the problem in
>> testing.
>
> I am confused.
>
> First, the quoted code should not cause any error, since this is a C++
> string class, not direct pointer indexing.
>
> Second, I just installed the 'd' package, and the postinstall script was
> successfully executed.

Oh, clarification:

First, the quoted code will throw an exception, my assumption above was 
wrong.

Second, the bug is only present on trunk, not on the release branch.

Max.



More information about the Cygwin-apps mailing list