[ccache] BUG: ccache -o <key>=<value> -- illegal values not rejected

Houder houder at xs4all.nl
Mon Jun 17 11:47:57 UTC 2019


Hi list,

Just reporting (it is not my intention to create an account
on github in order to report a bug).

Downloaded 3.7.1 and compiled it on Cygwin.

Call flow for "ccache -o <key>=<value>

ccache_main // src/ccache.c
   ccache_main_options // src/ccache.c
     conf_set_value_in_file // src/conf.c

conf_set_value_in_file
   find_conf(key)
   "insert (or replace) key/value in cfg file"

Function conf_set_value_in_file() only verifies that the key
makes sense; it does not check the user provided value.

Resulting in an _illegal_ value in the cfg file, if the user
provided an illegal value.

Subsequently, a command like "ccache -s" fails, reporting an
illegal cfg file.

Adding

      if (!item->parser(value, (char *)conf + item->offset, errmsg)) {
          *errmsg = format("Henri: unknown value \"%s\"", value);
          return false;
      }

after the call to find_key (in conf_set_value_in_file() )

rejects an illegal value.

Henri



More information about the ccache mailing list