mirror of
https://github.com/wolfpld/tracy.git
synced 2026-11-11 02:15:26 +00:00
Do not scan source length over the destination size.
This commit is contained in:
@@ -12,9 +12,10 @@ static inline size_t strzcpy( char* __restrict dst, const char* __restrict src,
|
||||
{
|
||||
assert( dstSize > 0 );
|
||||
|
||||
const auto srcSz = strlen( src );
|
||||
if( srcSz < dstSize )
|
||||
const auto end = (const char*)memchr( src, '\0', dstSize );
|
||||
if( end != nullptr )
|
||||
{
|
||||
const auto srcSz = end - src;
|
||||
memcpy( dst, src, srcSz + 1 );
|
||||
return srcSz;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user