Jan Slodicka wrote:
>  MemHandle hCmd = ClipboardGetItem( clipboardText, &cmdLength) ;
[...]
>   StrNCopy( cmd, cmdPtr, cmdLength ) ;       // This fails on accessing
> low memory address
[...]
> The problem is that StrNCopy() accesses cmdPtr[cmdLength]. The cure to
> the problem is to replace StrNCopy by MemMove.

Or to check that cmdptr/cmdLength are non-NULL/0 before calling
StrNCopy, perhaps?

> I guess if StrNCopy was implemented differently (if the test on the
> string length preceded the terminator test), there would not be any
> problem.

Yes; one could paraphrase this fix as "make StrNCopy act more like
strncpy" (details in my reply to the more recent thread below).

This issue last came up three years ago:

        http://www.escribe.com/computing/pcpef/m1998.html

and the previous time was apparently two years before that:

        http://www.egroups.com/message/palm-dev-forum/2812

    John  "stay tuned for a reappearance in 2007? :-)"

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to