mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05: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
cc841a7667
commit
653be2dbde
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;
|
return -1;
|
||||||
if (!spa_json_is_string(val, len)) {
|
if (!spa_json_is_string(val, len)) {
|
||||||
if (result != val)
|
if (result != val)
|
||||||
strncpy(result, val, len);
|
memmove(result, val, len);
|
||||||
result += len;
|
result += len;
|
||||||
} else {
|
} else {
|
||||||
for (p = val+1; p < val + len; p++) {
|
for (p = val+1; p < val + len; p++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue