On Thu, May 12, 2011 at 10:13:49AM +0100, David Gilbert wrote:
On 12 May 2011 10:07, Jiri Olsa <jolsa(a)redhat.com> wrote:
> On Wed, May 11, 2011 at 02:27:42PM +0100, David Gilbert wrote:
>> Hi,
>> On library functions like strcpy() where there is a destination
>> string, latrace -A ends up trying to print out the
>> destination buffer which may be completely invalid.
>>
> yep, it's just taking the pointer and prints it out
>
>> Maybe it's worth doing the same trick that ltrace does, and just
>> declare the destination parameters as void*
>
> hm, I wonder we could check on that string and handle bad
> characters somehow... display as byte values/finish the output
>
> I guess it might be worth for someone to see what the strcpy
> is actually changing
Yes you could use isprint() - but you don't know how big the destination
buffer is and thus you could just seg running off the end of a buffer
that doesn't as yet have a Nil terminator.
we could use the size of the src parameter and scan that amount of the
string.. if it segfaults it'd fail anyway when the function is called ;)
but having some parameters connected just for some functions
seems like bigger change
I'll check on that, but we can probably go with the dest parameters
being changed to void* as you suggested
thanks,
jirka
Dave
_______________________________________________
latrace mailing list
latrace(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/latrace