mirror of
https://github.com/curl/curl.git
synced 2026-05-30 05:57:29 +03:00
tool_doswin: add debug envs to test filename sanitization failure modes
- `CURL_FN_SANITIZE_BAD=<any-value>` to simulate `SANITIZE_ERR_INVALID_PATH`. - `CURL_FN_SANITIZE_OOM=<any-value>` to simulate `SANITIZE_ERR_OUT_OF_MEMORY`. Both are Windows/MS-DOS-specific and require debug-enabled curl build. Cherry-picked from #20116 Closes #20125
This commit is contained in:
parent
37d871af01
commit
8c02407bef
1 changed files with 7 additions and 0 deletions
|
|
@ -206,6 +206,13 @@ SANITIZEcode sanitize_file_name(char ** const sanitized, const char *file_name,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
if(getenv("CURL_FN_SANITIZE_BAD"))
|
||||
return SANITIZE_ERR_INVALID_PATH;
|
||||
if(getenv("CURL_FN_SANITIZE_OOM"))
|
||||
return SANITIZE_ERR_OUT_OF_MEMORY;
|
||||
#endif
|
||||
|
||||
*sanitized = target;
|
||||
return SANITIZE_ERR_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue