mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive list: fix crash on dive import
In commit 8c2383b495
dive merging was
changed to not modify the original dive. On import, dives were then
merged and the original deleted. The merge_weightsystem_info() was
not adapted accordingly (deep copy of string instead of pointer),
leading to a use-after-free crash.
Resolve this by doing a deep copy.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
604d563a87
commit
471fc1dfc8
1 changed files with 2 additions and 1 deletions
|
@ -2130,7 +2130,8 @@ static void merge_weightsystem_info(weightsystem_t *res, const weightsystem_t *a
|
||||||
{
|
{
|
||||||
if (!a->weight.grams)
|
if (!a->weight.grams)
|
||||||
a = b;
|
a = b;
|
||||||
*res = *a;
|
res->weight = a->weight;
|
||||||
|
res->description = copy_string(a->description);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get_cylinder_idx_by_use(): Find the index of the first cylinder with a particular CCR use type.
|
/* get_cylinder_idx_by_use(): Find the index of the first cylinder with a particular CCR use type.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue