resolver: fix gcc 9.2.0 warning
message_name_get() adds "." to the tail and it leads to:
strncpy(&dest, ".", 1);
gcc 9.2.0 generates a warning, because string is truncated without
copying trailing '\0'. Replace strncpy() with memcpy() to fix the
warning.
This commit is contained in:
@@ -260,7 +260,7 @@ static size_t message_name_append_safe(char *name, size_t name_len,
|
|||||||
copy_len = name_max > name_len ? name_max - name_len : 0;
|
copy_len = name_max > name_len ? name_max - name_len : 0;
|
||||||
copy_len = xmpp_min(tail_len, copy_len);
|
copy_len = xmpp_min(tail_len, copy_len);
|
||||||
if (copy_len > 0)
|
if (copy_len > 0)
|
||||||
strncpy(&name[name_len], tail, copy_len);
|
memcpy(&name[name_len], tail, copy_len);
|
||||||
|
|
||||||
return name_len + tail_len;
|
return name_len + tail_len;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user