mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
utils: use memmove when src and dst can overlap
spa_json_parse_stringn() can be used when the strings source and destination are overlapping so use memmove instead of strncpy to avoid corruption of the strings.
This commit is contained in:
parent
ce86b9a398
commit
c52c56621d
1 changed files with 1 additions and 1 deletions
|
|
@ -339,7 +339,7 @@ static inline int spa_json_parse_stringn(const char *val, int len, char *result,
|
|||
return -1;
|
||||
if (!spa_json_is_string(val, len)) {
|
||||
if (result != val)
|
||||
strncpy(result, val, len);
|
||||
memmove(result, val, len);
|
||||
result += len;
|
||||
} else {
|
||||
for (p = val+1; p < val + len; p++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue