aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSree Harsha Totakura <sreeharsha@totakura.in>2015-03-26 19:39:16 +0100
committerSree Harsha Totakura <sreeharsha@totakura.in>2015-03-26 19:39:16 +0100
commit7730a083494c0d49705f87b32fc85dfa6ed6809a (patch)
treede1f65ff2c8e18f7d0acbd5da4576ac1c8e70254 /src/util
parentffe1ec4cb9c9ad23ecba095acb4e38edb741b402 (diff)
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.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/amount.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/amount.c b/src/util/amount.c
index 5e7f69fd9..c13c9101e 100644
--- a/src/util/amount.c
+++ b/src/util/amount.c
@@ -348,7 +348,7 @@ TALER_amount_subtract (struct TALER_Amount *diff,
return GNUNET_SYSERR;
}
GNUNET_assert (GNUNET_OK ==
- TALER_amount_get_zero (a1->currency,
+ TALER_amount_get_zero (n1.currency,
diff));
GNUNET_assert (n1.fraction >= n2.fraction);
diff->fraction = n1.fraction - n2.fraction;