mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Add recursion depth protection to LIKE matching.
Since MatchText() recurses, it could in principle be driven to stack overflow, although quite a long pattern would be needed.
This commit is contained in:
@@ -83,6 +83,9 @@ MatchText(char *t, int tlen, char *p, int plen,
|
||||
if (plen == 1 && *p == '%')
|
||||
return LIKE_TRUE;
|
||||
|
||||
/* Since this function recurses, it could be driven to stack overflow */
|
||||
check_stack_depth();
|
||||
|
||||
/*
|
||||
* In this loop, we advance by char when matching wildcards (and thus on
|
||||
* recursive entry to this function we are properly char-synced). On other
|
||||
|
Reference in New Issue
Block a user