diff options
Diffstat (limited to 'smallapp/unbound-anchor.c')
| -rw-r--r-- | smallapp/unbound-anchor.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/smallapp/unbound-anchor.c b/smallapp/unbound-anchor.c index 00ab5e2ae0ef..68ff3ccc7b22 100644 --- a/smallapp/unbound-anchor.c +++ b/smallapp/unbound-anchor.c @@ -420,8 +420,14 @@ read_builtin_cert(void) { const char* builtin_cert = get_builtin_cert(); STACK_OF(X509)* sk; - BIO *bio = BIO_new_mem_buf((void*)builtin_cert, - (int)strlen(builtin_cert)); + BIO *bio; + char* d = strdup(builtin_cert); /* to avoid const warnings in the + changed prototype of BIO_new_mem_buf */ + if(!d) { + if(verb) printf("out of memory\n"); + exit(0); + } + bio = BIO_new_mem_buf(d, (int)strlen(d)); if(!bio) { if(verb) printf("out of memory\n"); exit(0); @@ -432,6 +438,7 @@ read_builtin_cert(void) exit(0); } BIO_free(bio); + free(d); return sk; } |
