On 9/14/09 9:54 PM, Andrew Farmer said:
>> Yes, sprintf is pure evil. snprintf is less evil.
>>
>> Also, I recommend adding -fstack-protector -D_FORTIFY_SOURCE=2, they
>> can
>> help catch some of these problems. And valgrind would probably have
>> caught this problem immediately.
>
>Sadly, valg
On 14 Sep 2009, at 11:48, Sean McBride wrote:
On 9/13/09 12:01 PM, Jens Alfke said:
It would be best to convert all your sprintf calls to snprintf, which
is a safer equivalent that won't overflow the buffer.
Yes, sprintf is pure evil. snprintf is less evil.
Also, I recommend adding -fstack-p
On 9/13/09 12:01 PM, Jens Alfke said:
>It would be best to convert all your sprintf calls to snprintf, which
>is a safer equivalent that won't overflow the buffer.
Yes, sprintf is pure evil. snprintf is less evil.
Also, I recommend adding -fstack-protector -D_FORTIFY_SOURCE=2, they can
help cat
On Sun, Sep 13, 2009 at 8:42 PM, Greg Guerin wrote:
> Or just try the simple expedient:
>
> char str[80];
>
> -- GG
Right, it was a buffer overrun. Simple as that. Thanks guys!
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not pos
It would be best to convert all your sprintf calls to snprintf, which
is a safer equivalent that won't overflow the buffer. If the value is
too long to fit, it'll be truncated instead of overflowing and
corrupting the stack. (This type of overflow is one of the main causes
of security holes
Sprintf() is returning the same value, using %d on 10.5.
I meant sprintf()'s returned int value, which is the count of
formatted output chars, not including the trailing null. Read 'man
sprintf'.
Or just try the simple expedient:
char str[80];
-- GG
_
In this case val was exactly nine digits: 213294334. But it can also
be greater sometimes.
Sprintf() is returning the same value, using %d on 10.5.
On Sun, Sep 13, 2009 at 8:21 PM, Greg Guerin wrote:
>> char str[10];
>> sprintf(str, "%d", val);
>
> What is the value of val at the time the crash
char str[10];
sprintf(str, "%d", val);
What is the value of val at the time the crash occurs? Will it
always convert to 9 digits or less?
What value is sprintf() returning?
You might want to use snprintf() or asprintf().
-- GG
___
Cocoa-dev
On Sun, Sep 13, 2009 at 8:10 PM, slasktrattena...@gmail.com
wrote:
> On Sun, Sep 13, 2009 at 8:01 PM, Bill Bumgarner wrote:
>> On Sep 13, 2009, at 10:59 AM, slasktrattena...@gmail.com wrote:
>> I'm updating my code for Snow Leopard and ran into this problem. The
>>>
>>> app crashes at this line:
On Sep 13, 2009, at 11:10 AM, slasktrattena...@gmail.com wrote:
On Sun, Sep 13, 2009 at 8:01 PM, Bill Bumgarner wrote:
On Sep 13, 2009, at 10:59 AM, slasktrattena...@gmail.com wrote:
I'm updating my code for Snow Leopard and ran into this problem. The
app crashes at this line:
sprintf(str,
On Sun, Sep 13, 2009 at 8:01 PM, Bill Bumgarner wrote:
> On Sep 13, 2009, at 10:59 AM, slasktrattena...@gmail.com wrote:
> I'm updating my code for Snow Leopard and ran into this problem. The
>>
>> app crashes at this line:
>>
>> sprintf(str, "%d", val);
>>
>> where val is a CFIndex. According to
On Sep 13, 2009, at 10:59 AM, slasktrattena...@gmail.com wrote:
I'm updating my code for Snow Leopard and ran into this problem. The
app crashes at this line:
sprintf(str, "%d", val);
where val is a CFIndex. According to the string programming guide
here...
http://developer.apple.com/mac/li
Hi,
I'm updating my code for Snow Leopard and ran into this problem. The
app crashes at this line:
sprintf(str, "%d", val);
where val is a CFIndex. According to the string programming guide here...
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Strings/Articles/formatSpec
13 matches
Mail list logo