mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-28 16:14:35 +08:00
Fix coverity scan 159296, dereference after null check
This commit is contained in:
@@ -286,7 +286,7 @@ BROKER_EXPORT char *mosquitto_strndup(const char *s, size_t n)
|
||||
str = mosquitto_malloc(size + 1);
|
||||
if(str){
|
||||
memcpy(str, s, size);
|
||||
str[size] = 0;
|
||||
}
|
||||
str[size] = 0;
|
||||
return str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user