This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Bug in ClassEStd::StrCpy?


Bug in ClassEStd::StrCpy?

Postby laughingkiwi » Jun 1, 2010 @ 11:13pm

laughingkiwi
pm Member
 
Posts: 7
Joined: May 24, 2010 @ 12:22pm


Re: Bug in ClassEStd::StrCpy?

Postby edge » Jun 8, 2010 @ 5:21pm

Hi,

The bug occurs because the destination array is too small for the 4 characters and the required NULL character at the end. The character array containing "ABCD" needs to be at least 5 bytes big.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Re: Bug in ClassEStd::StrCpy?

Postby laughingkiwi » Jun 13, 2010 @ 1:39am

So the answer is to use strncpy. I cannot increase the size of the buffer by 1 byte because it is part of a larger data structure. The only viable workaround is to use strncpy or possibly ClassEMemory::MemCpy instead of ClassEStd::StrCpy. I raised this as a possible bug to the different behaviour between StrCpy and strncpy which I thought would behave the same.
laughingkiwi
pm Member
 
Posts: 7
Joined: May 24, 2010 @ 12:22pm


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron