From a13d46b2952b2195c79db6a883087dd5f6fa370e Mon Sep 17 00:00:00 2001 From: Rakholiya Jenish Date: Thu, 12 May 2016 01:33:16 +0530 Subject: [PATCH] fix CID 1355197, 1355198 and 1355199 cleanup Signed-off-by: Riccardo Schirone --- libr/crypto/p/crypto_rc6.c | 3 ++- libr/util/punycode.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libr/crypto/p/crypto_rc6.c b/libr/crypto/p/crypto_rc6.c index 1890f1304f..95b2faa974 100644 --- a/libr/crypto/p/crypto_rc6.c +++ b/libr/crypto/p/crypto_rc6.c @@ -1,5 +1,6 @@ /* radare - LGPL - Copyright 2016 - pancake */ +//Implemented AES version of RC6. keylen = 16, 23, or 32 bytes; w = 32; and r = 20. #include #include @@ -30,7 +31,7 @@ static bool rc6_init(struct rc6_state *const state, const ut8 *key, int keylen, int t = 2 * r + 4; ut32 L[c]; ut32 A = 0, B = 0, k = 0, j = 0; - ut32 v = 3 * ((c > t) ? c : t); + ut32 v = 3 * t; //originally v = 2 * ((c > t) ? c : t); int i, off; diff --git a/libr/util/punycode.c b/libr/util/punycode.c index a77dc0bf01..8b1ac7fa04 100644 --- a/libr/util/punycode.c +++ b/libr/util/punycode.c @@ -11,12 +11,13 @@ #define INITIAL_BIAS 72 ut32 adapt_bias(ut32 delta, unsigned n_points, int is_first) { - ut32 k; + ut32 k = 0; delta /= is_first ? DAMP : 2; delta += delta / n_points; - for (k = 0; k > ((BASE - TMIN) * TMAX) / 2; k += BASE) { + while (delta > ((BASE - TMIN) * TMAX) / 2) { delta /= (BASE - TMIN); + k += BASE; } return k + (((BASE - TMIN + 1) * delta) / (delta + SKEW));