1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

wildcard.c: allow the matched string to be a ptrlen.

The main wildcard matching code now doesn't depend on having a NUL
terminator in the string to be matched; instead it works with a pair
of pointers, one working along the string as we match, and the other
identifying the end of the string, and tests that p < target_end
before dereferencing p. User-facing entry points now allow you to pass
either an ordinary ASCIZ const char * or a ptrlen, and set up
target_end accordingly.

For the moment, the _wildcard_ parameter still has to be an ordinary
null-terminated string, but who knows, maybe that will have to change
too at some later point.
This commit is contained in:
Simon Tatham
2018-10-23 18:02:35 +01:00
parent cf8a421fa2
commit d1eb40950c
2 changed files with 24 additions and 10 deletions

View File

@ -1679,6 +1679,7 @@ int agent_exists(void);
* Exports from wildcard.c
*/
const char *wc_error(int value);
int wc_match_pl(const char *wildcard, ptrlen target);
int wc_match(const char *wildcard, const char *target);
int wc_unescape(char *output, const char *wildcard);