diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-23 14:56:44 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-23 14:56:44 +0200 |
commit | d82dde61deb60d6065d55b9c59851350033622ef (patch) | |
tree | ba4ce876f5d1ac4d8e7b1acc191068e5daabba88 /src | |
parent | add passphrase_wipe (diff) | |
download | libpassphrase-d82dde61deb60d6065d55b9c59851350033622ef.tar.gz libpassphrase-d82dde61deb60d6065d55b9c59851350033622ef.tar.bz2 libpassphrase-d82dde61deb60d6065d55b9c59851350033622ef.tar.xz |
fix warnings1400850322
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/passphrase.c | 10 |
1 files changed, 7 insertions, 3 deletions
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--; } |