Fix base64 decoding of Ed25519 keys.
[tinc] / src / utils.c
index 594c91a..0d7bc02 100644 (file)
@@ -75,7 +75,7 @@ int b64decode(const char *src, void *dst, int length) {
        uint32_t triplet = 0;
        unsigned char *udst = (unsigned char *)dst;
 
-       for(i = 0; i < length / 3 * 4 && src[i]; i++) {
+       for(i = 0; i < length && src[i]; i++) {
                triplet |= base64_decode[src[i] & 0xff] << (6 * (i & 3));
                if((i & 3) == 3) {
                        if(triplet & 0xff000000U)