mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-26 12:05:59 +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