mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-07 05:06:37 +02:00
using memmove instead of memcpy for potentially overlapping bignum copies
This commit is contained in:
parent
47a1c61117
commit
998951cab0
1 changed files with 3 additions and 3 deletions
|
@ -79,12 +79,12 @@ sexp sexp_copy_bignum (sexp ctx, sexp dst, sexp a, sexp_uint_t len0) {
|
|||
size = sexp_sizeof(bignum) + len*sizeof(sexp_uint_t);
|
||||
if (! dst || sexp_bignum_length(dst) < len) {
|
||||
dst = sexp_alloc_tagged(ctx, size, SEXP_BIGNUM);
|
||||
memcpy(dst, a, size);
|
||||
memmove(dst, a, size);
|
||||
sexp_bignum_length(dst) = len;
|
||||
} else {
|
||||
memset(dst->value.bignum.data, 0,
|
||||
sexp_bignum_length(dst)*sizeof(sexp_uint_t));
|
||||
memcpy(dst->value.bignum.data, a->value.bignum.data,
|
||||
memmove(dst->value.bignum.data, a->value.bignum.data,
|
||||
sexp_bignum_length(a)*sizeof(sexp_uint_t));
|
||||
}
|
||||
return dst;
|
||||
|
|
Loading…
Add table
Reference in a new issue