> Am 04.06.2020 um 09:04 schrieb [email protected]:
> 
> Author: gbechis
> Date: Thu Jun  4 07:04:09 2020
> New Revision: 1878462
> 
> URL: http://svn.apache.org/viewvc?rev=1878462&view=rev
> Log:
> Add error checks in md_json_readb
> 
> Modified:
>    httpd/httpd/trunk/modules/md/md_json.c
> 
> Modified: httpd/httpd/trunk/modules/md/md_json.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/md/md_json.c?rev=1878462&r1=1878461&r2=1878462&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/md/md_json.c (original)
> +++ httpd/httpd/trunk/modules/md/md_json.c Thu Jun  4 07:04:09 2020
> @@ -1101,11 +1101,14 @@ apr_status_t md_json_readb(md_json_t **p
>     json_t *j;
> 
>     j = json_load_callback(load_cb, bb, 0, &error);
> -    if (!j) {
> -        return APR_EINVAL;
> +    if (j) {
> +        *pjson = json_create(pool, j);
> +    } else {
> +        md_log_perror(MD_LOG_MARK, MD_LOG_ERR, 0, pool,
> +                      "failed to load JSON file: %s (line %d:%d)",
> +                      error.text, error.line, error.column);
>     }
> -    *pjson = json_create(pool, j);
> -    return APR_SUCCESS;
> +    return (j && *pjson) ? APR_SUCCESS : APR_EINVAL;
> }
> 
> static size_t load_file_cb(void *data, size_t max_len, void *baton)

This does not seem to hurt, but how does it help? json_create() always succeeds 
in our server, since failed pool allocations lead to an abort. Did I miss 
something?

Cheers, Stefan

Reply via email to