Avoid pass NULL to memcmp() (#3844)
If we exec "StringVal(len=0, ptr="") == StringVal(len=0,ptr=NULL)", it will pass NULL ptr to memcmp(). It should be avoided.
This commit is contained in:
@ -644,7 +644,7 @@ struct StringVal : public AnyVal {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ptr == other.ptr || memcmp(ptr, other.ptr, len) == 0;
|
||||
return len == 0 || ptr == other.ptr || memcmp(ptr, other.ptr, len) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const StringVal& other) const {
|
||||
|
||||
Reference in New Issue
Block a user