compute memory requirement for PEM-encoding correctly
This commit is contained in:
@@ -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;
|
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);
|
*encoding = chunk_alloc(5 + 2*(6 + strlen(label) + 6) + 3 + pem_chars + pem_lines);
|
||||||
pos = encoding->ptr;
|
pos = encoding->ptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user