[sword-devel] installmgr (and xiphos) crashes (svn 2831)
Mark Trompell
mark at foresightlinux.org
Mon Jul 1 04:45:28 MST 2013
At:
248 250 pBuf++;
249 251 pBuf = strstr(pBuf, "<a href=\"");//Find the next link to a
possible file name.
how do we know that pBuf++ is actually not outside our buffer?
btw, why abort if pBufRes > pBuf?
why not something like probably even uglier attached patch?
I want to get deeper inside C and C++ so I want to understand.
On Thu, Jun 27, 2013 at 10:33 PM, Jaak Ristioja <jaak at ristioja.ee> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Patch for pointer dereference issue:
>
>
> https://gitorious.org/~jotik/sword-svn-mirrors/jotiks-sword-trunk/commit/1b8ab91ff994c8584d6c61cb7d334273732d8216
>
> Patch for buffer overflow:
>
>
> https://gitorious.org/~jotik/sword-svn-mirrors/jotiks-sword-trunk/commit/4a261b27a7bec9d9300da6c357666a3851f3d34e
>
> There you go! Took me half an hour.
>
> Blessings,
> Jaak
>
> On 27.06.2013 22:41, Mark Trompell wrote:
>> I see. I'll try to come up with a better patch on Monday. I won't
>> have time earlier. Blessings Mark --- Ursprüngl. Mitteilung ---
>> Von: Jaak Ristioja Gesend.: 27.06.2013, 16:15 An:
>> sword-devel at crosswire.org Betreff: Re: [sword-devel] installmgr
>> (and xiphos) crashes (svn 2831)
>>
>>
>> I think you only fixed pBuf not being set to NULL prematurely. But
>> this:
>>
>> memset(possibleName, 0, 400);
>>
>> doesn't help. The sprintf function always writes a terminating \0
>> character. The problem is not that a \0 character is not written,
>> because it is written (unless a memory error occurs first). The
>> problem is that if possibleNameLength > 399 then it writes the
>> characters (including the terminating \0 character) past the end
>> of the possibleName buffer, corrupting memory, potentially outside
>> of the virtual address space of the program (usually triggering the
>> OS to kill the process with a segfault or something).
>>
>> The memset call is not needed, but it should be checked that
>> possibleNameLength < 400 (strictly "less-than"). Otherwise
>>
>> sprintf(possibleName, "%.*s", possibleNameLength, pBuf);
>>
>> is a security vulnerability. I wonder whether a CVE is required.
>>
>>
>> Blessings, Jaak
>>
>> On 27.06.2013 14:45, Mark Trompell wrote:
>>> Sending again with tabs instead of blancs in the first hunk
>>
>>> On Thu, Jun 27, 2013 at 1:17 PM, Mark Trompell
>>> <mark at foresightlinux.org> wrote:
>>>> I just fixed it :). Attached patch will initialize
>>>> possibleNames with 0 bytes to make sure we always have the name
>>>> 0 terminated properly. and it will move the pBuf=pBufRes into
>>>> the check for ifBufRes != NULL, in case no filesize is found
>>>> (because of another apache is displaying it differently)
>>>> Shouldn't break existing setups.
>>
>>
>>
>>
>>> _______________________________________________ sword-devel
>>> mailing list: sword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>>
>>
>>
>> _______________________________________________ sword-devel mailing
>> list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel Instructions
>> to unsubscribe/change your settings at above page
>>
>>
>> _______________________________________________ sword-devel mailing
>> list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel Instructions
>> to unsubscribe/change your settings at above page
>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.20 (GNU/Linux)
>
> iQgcBAEBAgAGBQJRzKGMAAoJEEqsYmEt1rCOKTI//ive2vm6lFnJkuBfZHBsGnSF
> aSm5JAyksfatvrQ7rcFsL9WOINMAXXZW9qQ6w7PThxreEBUALuE9iSGF6RaSzWkW
> Q6mBXZuX2ROHYFY9PbtfA5K6c2roNLF03o88YKafADORlCqXpgPfLsY1lL2G9q8w
> LjmMOQGyCPAxzOdgr8Ll5mjWhv71X00n11Z0lK7QOct58Jj/yHTi/0/IoOdplZeo
> neWK83hbo/yFlrSP37mzBvLAQKEXEHaQdHRi2bj9jL9KCT70WC0QB8BkJDGqhh70
> U7IHkTBrH+AaWD0jlirFUTe6rs1jm3Zgn/mqCiM8yFb2/RBT/csn0TOpCYvLIu+9
> WXTjXRn7Vix/r2c1opejigM2387rYXkhQCdQxqddq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n7mCXvDvHc6a8VMzQQ4POYtym4ZOZBrOctRLbLsFFVPysmD2uaKm7O
> 3/6futlB7ASRqunaOcNSwRKDv1Rv3mz5KZD48wEZl/5sTONjjmCWQbshmV+Rd0XH
> 3u9433ODZ0/A6Lq8fE6T7P3ORLDMvEcPTMFCdTpuBy2KRoMXKFRlk/4FHeOUIM/S
> NoxhGFPpLpmMZAmIMPMEBiLGny8A3PWGYR0RED3Fo7IpnHB1aFFwNRtiuola0g4U
> ++gWf0P7CVU6lUCzkC3f
> =XzwD
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
--
Mark Trompell
Foresight Linux Xfce Edition
Cause your desktop should be freaking cool
(and Xfce)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_curl_http_crash.patch
Type: application/octet-stream
Size: 2467 bytes
Desc: not available
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20130701/bf02e363/attachment.obj>
More information about the sword-devel
mailing list