compute memory requirement for PEM-encoding correctly
authorAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 7 Jan 2011 04:28:17 +0000 (05:28 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 7 Jan 2011 04:29:59 +0000 (05:29 +0100)
src/libstrongswan/plugins/pem/pem_encoder.c

index e255d6f..9c8237e 100644 (file)
@@ -111,7 +111,7 @@ bool pem_encoder_encode(cred_encoding_type_t type, chunk_t *encoding,
        }
 
        /* compute and allocate maximum size of PEM object */
        }
 
        /* compute and allocate maximum size of PEM object */
-       pem_chars = 4*(asn1.len + 2)/3;
+       pem_chars = 4 * ((asn1.len + 2) / 3);
        pem_lines = (asn1.len + BYTES_PER_LINE - 1) / BYTES_PER_LINE;
        *encoding = chunk_alloc(5 + 2*(6 + strlen(label) + 6) + 3 + pem_chars + pem_lines);
        pos = encoding->ptr;
        pem_lines = (asn1.len + BYTES_PER_LINE - 1) / BYTES_PER_LINE;
        *encoding = chunk_alloc(5 + 2*(6 + strlen(label) + 6) + 3 + pem_chars + pem_lines);
        pos = encoding->ptr;