File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ class judyS2Array {
5151 explicit judyS2Array ( const judyS2Array< JudyValue > & other ): _maxKeyLen( other._maxKeyLen ), _success( other._success ) {
5252 _judyarray = judy_clone ( other._judyarray );
5353 _buff = new unsigned char [_maxKeyLen];
54- strncpy ( _buff, other._buff , _maxKeyLen );
55- _buff[ _maxKeyLen ] = ' \0 ' ; // ensure that _buff is null-terminated, since strncpy won't necessarily do so
54+ strncpy ( reinterpret_cast < char * >( _buff ), reinterpret_cast < const char * >( other._buff ) , _maxKeyLen - 1 );
55+ _buff[ _maxKeyLen - 1 ] = ' \0 ' ; // ensure that _buff is null-terminated
5656 find ( _buff ); // set _lastSlot
5757 }
5858
Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ class judySArray {
3939 explicit judySArray ( const judySArray< JudyValue > & other ): _maxKeyLen( other._maxKeyLen ), _success( other._success ) {
4040 _judyarray = judy_clone ( other._judyarray );
4141 _buff = new unsigned char [_maxKeyLen];
42- strncpy ( _buff, other._buff , _maxKeyLen );
43- _buff[ _maxKeyLen ] = ' \0 ' ; // ensure that _buff is null-terminated, since strncpy won't necessarily do so
42+ strncpy ( reinterpret_cast < char * >( _buff ), reinterpret_cast < const char * >( other._buff ) , _maxKeyLen - 1 );
43+ _buff[ _maxKeyLen - 1 ] = ' \0 ' ; // ensure that _buff is null-terminated
4444 find ( _buff ); // set _lastSlot
4545 }
4646
You can’t perform that action at this time.
0 commit comments