From: Daniel Stenberg Date: Mon, 25 Apr 2022 09:38:37 +0000 (+0200) Subject: tool_getparam: error out on missing -K file X-Git-Tag: curl-7_83_0~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a09a12806e5e6abd9e11f13e8fc061f801a797c8;p=thirdparty%2Fcurl.git tool_getparam: error out on missing -K file Add test 411 to verify. Reported-by: Median Median Stride Bug: https://hackerone.com/reports/1542881 Closes #8731 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 52a247d27a..67de74dff7 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -1948,9 +1948,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ config->insecure_ok = toggle; break; case 'K': /* parse config file */ - if(parseconfig(nextarg, global)) - warnf(global, "error trying read config from the '%s' file\n", - nextarg); + if(parseconfig(nextarg, global)) { + errorf(global, "cannot read config from '%s'\n", nextarg); + return PARAM_READ_ERROR; + } break; case 'l': config->dirlistonly = toggle; /* only list the names of the FTP dir */ diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 7e9b6b4fb7..76910f98fd 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -68,7 +68,7 @@ test380 test381 test383 test384 test385 test386 \ test392 test393 test394 test395 test396 test397 test398 \ \ test400 test401 test402 test403 test404 test405 test406 test407 test408 \ -test409 test410 \ +test409 test410 test411 \ \ test430 test431 test432 test433 test434 test435 test436 \ \ diff --git a/tests/data/test411 b/tests/data/test411 new file mode 100644 index 0000000000..912f07c6c4 --- /dev/null +++ b/tests/data/test411 @@ -0,0 +1,43 @@ + + + +-K + + + +# +# Server-side + + + +# +# Client-side + + +none + + +-K with missing file causes error + + +-K log/missing http://localhost + + + +# +# Verify data after the test has been "shot" + + +curl: cannot read config from 'log/missing' +curl: option -K: error encountered when reading a file +%if manual +curl: try 'curl --help' or 'curl --manual' for more information +%else +curl: try 'curl --help' for more information +%endif + + +26 + + +