mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-18 15:18:17 +00:00
Clean up a bunch of valgrind errors, nix a potentially unsafe op in Buffer assignment operator.
This commit is contained in:
@ -124,7 +124,7 @@ public:
|
||||
{
|
||||
if (b._l > C)
|
||||
throw std::out_of_range("Buffer: assignment from buffer larger than capacity");
|
||||
memcpy(this,&b,sizeof(_l) + b._l); // one memcpy for all fields
|
||||
memcpy(_b,b._b,_l = b._l);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -357,6 +357,15 @@ public:
|
||||
memset(_b + _l,0,C - _l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unconditionally zero buffer's underlying memory
|
||||
*/
|
||||
inline void zeroAll()
|
||||
throw()
|
||||
{
|
||||
memset(_b,0,sizeof(_b));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Size of data in buffer
|
||||
*/
|
||||
|
Reference in New Issue
Block a user