diff options
author | dgp <dgp@users.sourceforge.net> | 2017-09-05 12:28:41 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-09-05 12:28:41 (GMT) |
commit | 018892450cdacc7e4660a4cc138a51e1143a2b12 (patch) | |
tree | bc8d5053c422ca180b237864f9522bb64c885cf9 /libtommath/bn_mp_read_radix.c | |
parent | d23fe52664cbef62956cc8ba4e689b9873992b0c (diff) | |
parent | edb7af10d93df44cc25e9dce384c61669ce73dc8 (diff) | |
download | tcl-tip_282.zip tcl-tip_282.tar.gz tcl-tip_282.tar.bz2 |
merge trunktip_282
Diffstat (limited to 'libtommath/bn_mp_read_radix.c')
-rw-r--r-- | libtommath/bn_mp_read_radix.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 93ccd3b..12aa499 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -48,7 +48,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix) * this allows numbers like 1AB and 1ab to represent the same value * [e.g. in hex] */ - ch = (radix <= 36) ? (char)toupper((unsigned char)*str) : *str; + ch = (radix <= 36) ? (char)toupper((int)*str) : *str; for (y = 0; y < 64; y++) { if (ch == mp_s_rmap[y]) { break; @@ -71,11 +71,10 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } ++str; } - - /* if an illegal character was found, fail. */ - if ( *str != '\0' ) { - mp_zero( a ); + /* if an illegal character was found, fail. */ + if (!(*str == '\0' || *str == '\r' || *str == '\n')) { + mp_zero(a); return MP_VAL; } @@ -87,6 +86,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ |