On Mon, Oct 21, 2013 at 2:30 AM, <n...@apache.org> wrote:

> Author: niq
> Date: Mon Oct 21 00:30:26 2013
> New Revision: 1534015
>
> URL: http://svn.apache.org/r1534015
> Log:
> Fix r55670.  Not a great idea to dereference process after pool destroy!
>
> Modified:
>     httpd/httpd/trunk/server/main.c
>
> Modified: httpd/httpd/trunk/server/main.c
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/main.c?rev=1534015&r1=1534014&r2=1534015&view=diff
>
> ==============================================================================
> --- httpd/httpd/trunk/server/main.c (original)
> +++ httpd/httpd/trunk/server/main.c Mon Oct 21 00:30:26 2013
> @@ -264,12 +264,17 @@ static void destroy_and_exit_process(pro
>       * by us before they can do so. In this case maybe valueable log
> messages
>       * might get lost.
>       */
> +
> +    /* If we are to print an error, we need the name before we destroy
> pool.
> +     * short_name is a pointer into argv, so remains valid.
> +     */
> +    const char *name = process->short_name ? process->short_name :
> "httpd";
> +
>

Shouldn't this be safe from terminal controls, eg :
    const char *name = process->short_name;
    if (!name ||
!*name || 
ap_has_cntrl(name)) {
        name = "httpd";
    }
?


>      apr_sleep(TASK_SWITCH_SLEEP);
>      ap_main_state = AP_SQ_MS_EXITING;
>      apr_pool_destroy(process->pool); /* and destroy all descendent pools
> */
>      apr_terminate();
>      if ((process_exit_value != 0) && isatty(fileno(stderr))) {
> -        const char *name = process->short_name ? process->short_name :
> "httpd";
>          fprintf(stderr, "%s: abnormal exit %d\n", name,
> process_exit_value);
>      }
>      exit(process_exit_value)


Regards.

Reply via email to