libfdt: Correct the string size while renaming fragments in property

Copy the actual string size instead of the rest of property size
when converting property value from fragment@M to fragment@M+delta,
it maybe overwrite the next node value.

Change-Id: I9ce2f0ea7a4b83cac5f7a7c9bd0c63eb229bf761
Signed-off-by: Lijuan Gao <quic_lijuang@quicinc.com>
This commit is contained in:
Lijuan Gao 2022-01-21 17:11:26 +08:00 committed by Bartłomiej Rudecki
parent 94542992b1
commit 3cc0eabfe9

View file

@ -1232,7 +1232,6 @@ static int rename_fragments_in_property(void *fdto, int offset,
ret = fdt_setprop_placeholder(fdto, offset, label, needed, &p); ret = fdt_setprop_placeholder(fdto, offset, label, needed, &p);
if (ret < 0) if (ret < 0)
return ret; return ret;
len = needed;
} }
start = p; start = p;
@ -1262,6 +1261,7 @@ static int rename_fragments_in_property(void *fdto, int offset,
if (available < needed) { if (available < needed) {
diff = needed - available; diff = needed - available;
memmove(stop + diff, stop, (end - stop)); memmove(stop + diff, stop, (end - stop));
end += diff;
} }
{ {