From d82dde61deb60d6065d55b9c59851350033622ef Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 23 May 2014 14:56:44 +0200 Subject: fix warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/passphrase.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/passphrase.c b/src/passphrase.c index 2b3da0e..9fb4ef5 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -192,7 +192,7 @@ char* passphrase_read(void) n++; for (i = point + n; i < len; i++) *(rc + i - n) = *(rc + i); - passphrase_wipe(rc + len - n, n); + passphrase_wipe(rc + len - n, (size_t)n); len -= n; n = 0; while (cn & 0x80) @@ -208,8 +208,10 @@ char* passphrase_read(void) size <<= 1L; } len += n; - for (i = len - 1; i >= point + n; i--) + for (i = len - 1; i > point + n; i--) *(rc + i) = *(rc + i - n); + if (len - 1 >= point + n) + *(rc + point + n) = *(rc + point); for (i = 0; i < n; i++) { if (i) @@ -271,8 +273,10 @@ char* passphrase_read(void) while (redo) { redo = (*(rc + point - 1) & 0xC0) == 0x80; - for (i = point; i <= len; i++) + for (i = point; i < len; i++) *(rc + i - 1) = *(rc + i); + if (point <= len) + *(rc + len - 1) = *(rc + len); point--; len--; } -- cgit v1.2.3-70-g09d2