pulse-server: use memcpy() to write string into message

The length of the string is already known, so use `memcpy()`
instead of `strcpy()` to copy the string into the message buffer.
This commit is contained in:
Barnabás Pőcze 2024-03-28 16:55:14 +01:00 committed by Wim Taymans
parent 150211a3f8
commit 4cea8eb01f

View file

@ -421,9 +421,9 @@ static void write_string(struct message *m, const char *s)
{
write_8(m, s ? TAG_STRING : TAG_STRING_NULL);
if (s != NULL) {
int len = strlen(s) + 1;
size_t len = strlen(s) + 1;
if (ensure_size(m, len) > 0)
strcpy(SPA_PTROFF(m->data, m->length, char), s);
memcpy(SPA_PTROFF(m->data, m->length, char), s, len);
m->length += len;
}
}