]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
mod_rewrite: disambiguate select_random_value_part().
authorYann Ylavic <ylavic@apache.org>
Thu, 14 Mar 2024 14:38:36 +0000 (14:38 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 14 Mar 2024 14:38:36 +0000 (14:38 +0000)
commitfb3dbd7da9e58517fc000d232fa34f62f2fe8ada
tree96bf428f17b1af45a9a8a302cfbf26a55a04c0d6
parentb3e19c3cebdf07aec9ffef07dc4a81a666450e33
mod_rewrite: disambiguate select_random_value_part().

gcc-13's -fsanitize=undefined finds:

    mod_rewrite.c|1702 col 37| error: '%s' directive argument is null [-Werror=format-overflow=]
    ||  1701 |             value = select_random_value_part(r, value);
    ||  1702 |             rewritelog((r, 5, NULL, "randomly chosen the subvalue `%s'",value));
    ||       |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

because it's not clear from select_random_value_part() whether it can return NULL or not.
Rewrite the function so that it's clearer/simpler.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916298 13f79535-47bb-0310-9956-ffa450edef68
modules/mappers/mod_rewrite.c