Hm, I'd be surprised if this patch had any effect: sizeof of a string literal
should give the number of bytes in it [which is a really
weird special case of C, see
http://en.wikipedia.org/wiki/Sizeof#Using_sizeof_with_arrays]
Although, strlen is a lot more obviously correct [curiously,
adding the +3 instead of +1 is actually the correct number for strlen,
which doesn't count '\0'] .

Perhaps just updating to git fixed the segfault?

Also I think the reason the patch didn't apply is probably because the
mailer mangled it, like Marc guessed.
Email clients particularly relish destroying a programmer's hard work.

On Wed, Aug 8, 2012 at 2:46 PM, Jon Trulson <j...@radscan.com> wrote:
> On Wed, 8 Aug 2012, Marc Balmer wrote:
>
>> Use strlen, not sizeof, here.  Fixes a segfault on Debian squeeze 64 bit
>> and most probably other systems, too.
>>
>> (If the mailer mangles the diff, I can resend it as attachment)
>>
>> diff --git a/cde/lib/DtSvc/DtUtil1/DtsMM.c b/cde/lib/DtSvc/DtUtil1/DtsMM.c
>> index dd82d6f..0004afa 100644
>> --- a/cde/lib/DtSvc/DtUtil1/DtsMM.c
>> +++ b/cde/lib/DtSvc/DtUtil1/DtsMM.c
>> @@ -567,8 +567,8 @@ _DtDtsMMCacheName(int override)
>>        /* unique file name instead. */
>>                char tmpnam_buf[L_tmpnam + 1];
>>
>> -               results = (char *)malloc(sizeof(_DTDTSMMTEMPDIR) +
>> -                                        sizeof(_DTDTSMMTEMPFILE) +
>> +               results = (char *)malloc(strlen(_DTDTSMMTEMPDIR) +
>> +                                        strlen(_DTDTSMMTEMPFILE) +
>>                                         L_tmpnam + 3);
>>                tmpnam(tmpnam_buf);
>>                sprintf(results, "%s/%s%s", _DTDTSMMTEMPDIR,
>> _DTDTSMMTEMPFILE,
>>
>
> error: patch failed: cde/lib/DtSvc/DtUtil1/DtsMM.c:567
> error: cde/lib/DtSvc/DtUtil1/DtsMM.c: patch does not apply
>
> I will apply manually, however in the future, please send patches as
> attachment, and base it off of current master HEAD, as there have
> already been other commits to this file. :)
>
> Also, this code is using tmpnam, might want to use mkstemp like a
> patch that was made earlier to cde/lib/DtSvc/DtUtil1/MMDb.c
>
> Oh, and thanks for the fix :)
>
> --
> Jon Trulson
>
> "If the Martian rope-a-dope don't get him, he'll get himself, he'll
>   come in too fast and punch himself out."
>               - one of my brothers, referring to the Curiosity landing.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> cdesktopenv-devel mailing list
> cdesktopenv-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to