]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap: Make sure imap_utf7_to_utf8() doesn't access invalid input string out of...
authorTimo Sirainen <tss@iki.fi>
Wed, 5 Jun 2013 14:49:46 +0000 (17:49 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 5 Jun 2013 14:49:46 +0000 (17:49 +0300)
src/lib-imap/imap-utf7.c

index 4c58a9118b270762049d611800322a9fd6ed2c29..bc9c0335eee63064889ef96ae8d65f4202003ef1 100644 (file)
@@ -179,8 +179,10 @@ static int mbase64_decode_to_utf8(string_t *dest, const char **_src)
 
        while (*src != '-') {
                input[0] = imap_b64dec[(uint8_t)src[0]];
+               if (input[0] == 0xff)
+                       return -1;
                input[1] = imap_b64dec[(uint8_t)src[1]];
-               if (input[0] == 0xff || input[1] == 0xff)
+               if (input[1] == 0xff)
                        return -1;
 
                output[outpos % 4] = (input[0] << 2) | (input[1] >> 4);