util: avoid memcpy over overlapping memory
memcpy used to copy the currency string in TALER_amount_get_zero can copy from overlapping memory regions. This happens when the diff parameter to TALER_amount_substract is same as a1 parameter.
This commit is contained in:
parent
ffe1ec4cb9
commit
7730a08349
@ -348,7 +348,7 @@ TALER_amount_subtract (struct TALER_Amount *diff,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
GNUNET_assert (GNUNET_OK ==
|
GNUNET_assert (GNUNET_OK ==
|
||||||
TALER_amount_get_zero (a1->currency,
|
TALER_amount_get_zero (n1.currency,
|
||||||
diff));
|
diff));
|
||||||
GNUNET_assert (n1.fraction >= n2.fraction);
|
GNUNET_assert (n1.fraction >= n2.fraction);
|
||||||
diff->fraction = n1.fraction - n2.fraction;
|
diff->fraction = n1.fraction - n2.fraction;
|
||||||
|
Loading…
Reference in New Issue
Block a user