aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2016-01-03 11:35:43 +1100
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2016-01-03 12:34:43 +1100
commit7a31bf07493d365f5b44581dc4aaf3c9d48179f0 (patch)
treeae9a39e95089552fd8673cdd80fcbfd110b33c64 /src
parentb2b301db7ad41238fdd1b6236eb917c11bf0bbbc (diff)
downloadluaossl-7a31bf07493d365f5b44581dc4aaf3c9d48179f0.tar.gz
luaossl-7a31bf07493d365f5b44581dc4aaf3c9d48179f0.tar.bz2
luaossl-7a31bf07493d365f5b44581dc4aaf3c9d48179f0.zip
bignum: bugfix: unm shouldn't modify it's operands
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c
index e146098..a73917a 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -1924,8 +1924,9 @@ static int bn__shr(lua_State *L) {
static int bn__unm(lua_State *L) {
BIGNUM *a = checksimple(L, 1, BIGNUM_CLASS);
+ BIGNUM *r = bn_dup(L, a);
- BN_set_negative(a, !BN_is_negative(a));
+ BN_set_negative(r, !BN_is_negative(a));
return 1;
} /* bn__unm() */