httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@gmail.com>
Subject Re: svn commit: r1703415 - in /httpd/test/framework/trunk/c-modules: authany/mod_authany.c test_session/mod_test_session.c
Date Wed, 16 Sep 2015 14:50:55 GMT
On Wed, Sep 16, 2015 at 9:18 AM, <jim@apache.org> wrote:

> Author: jim
> Date: Wed Sep 16 14:18:49 2015
> New Revision: 1703415
>
>...

> Modified:
> httpd/test/framework/trunk/c-modules/test_session/mod_test_session.c
> URL:
> http://svn.apache.org/viewvc/httpd/test/framework/trunk/c-modules/test_session/mod_test_session.c?rev=1703415&r1=1703414&r2=1703415&view=diff
>
> ==============================================================================
> --- httpd/test/framework/trunk/c-modules/test_session/mod_test_session.c
> (original)
> +++ httpd/test/framework/trunk/c-modules/test_session/mod_test_session.c
> Wed Sep 16 14:18:49 2015
> @@ -149,7 +149,6 @@ static apr_status_t test_session_encode(
>
>  static apr_status_t test_session_decode(request_rec * r, session_rec * z)
>  {
> -    apr_status_t result = OK;
>      const size_t prefix_len = strlen(TEST_SESSION_ENCODING_PREFIX);
>      test_session_dcfg_t *dconf = ap_get_module_config(r->per_dir_config,
>
>  &test_session_module);
> @@ -203,7 +202,7 @@ static int test_session_handler(request_
>          return DECLINED;
>
>      /* Copy the header for SessionHeader from the request to the
> response. */
> -    if (overrides = apr_table_get(r->headers_in, TEST_SESSION_HEADER))
> +    if ((overrides = apr_table_get(r->headers_in, TEST_SESSION_HEADER)))
>          apr_table_setn(r->headers_out, TEST_SESSION_HEADER, overrides);
>
>      /* Additional commands to test the session API via POST. */
> @@ -240,15 +239,15 @@ static int test_session_handler(request_
>              }
>              else if (!strcmp(pair->name, "name")) {
>                  apr_size_t len;
> -                apr_brigade_length(pair->value, 1, &len);
> +                apr_brigade_length(pair->value, 1, (apr_off_t *)&len);
>

This seems really dangerous. Aren't there cases where sizeof(apr_size_t) !=
sizeof(apr_off_t) ??


>                  fieldName = apr_pcalloc(r->pool, sizeof(char) * len + 1);
> -                result = apr_brigade_flatten(pair->value, fieldName,
> &len);
> +                result = apr_brigade_flatten(pair->value, fieldName,
> (apr_size_t *)&len);
>

This seems unnecessary. &len should already be apr_size_t *


>              }
>              else if (!strcmp(pair->name, "value")) {
>                  apr_size_t len;
> -                apr_brigade_length(pair->value, 1, &len);
> +                apr_brigade_length(pair->value, 1, (apr_off_t *)&len);
>                  fieldValue = apr_pcalloc(r->pool, sizeof(char) * len + 1);
> -                result = apr_brigade_flatten(pair->value, fieldValue,
> &len);
> +                result = apr_brigade_flatten(pair->value, fieldValue,
> (apr_size_t *)&len);
>

These two, same as above.

Heh. I haven't reviewed httpd code for years. But I saw a change to
mod_authany.c and thought "what is that? isn't that module crazy stable?"
... curiosity :-P

Cheers,
-g

Mime
View raw message