mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-22 05:33:53 -04:00
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:
parent
150211a3f8
commit
4cea8eb01f
1 changed files with 2 additions and 2 deletions
|
|
@ -421,9 +421,9 @@ static void write_string(struct message *m, const char *s)
|
||||||
{
|
{
|
||||||
write_8(m, s ? TAG_STRING : TAG_STRING_NULL);
|
write_8(m, s ? TAG_STRING : TAG_STRING_NULL);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
int len = strlen(s) + 1;
|
size_t len = strlen(s) + 1;
|
||||||
if (ensure_size(m, len) > 0)
|
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;
|
m->length += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue