Fix a casting bug with the length-independent sshbn code.
[u/mdw/putty] / import.c
index 1210cc5..01e2628 100644 (file)
--- a/import.c
+++ b/import.c
@@ -160,12 +160,11 @@ static int ber_read_id_len(void *source, int sourcelen,
     if ((*p & 0x1F) == 0x1F) {
        *id = 0;
        while (*p & 0x80) {
-           *id = (*id << 7) | (*p & 0x7F);
            p++, sourcelen--;
            if (sourcelen == 0)
                return -1;
+           *id = (*id << 7) | (*p & 0x7F);
        }
-       *id = (*id << 7) | (*p & 0x7F);
        p++, sourcelen--;
     } else {
        *id = *p & 0x1F;