aboutsummaryrefslogtreecommitdiff
path: root/lpcap.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-02-20 11:11:12 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-02-20 11:11:12 -0300
commitf53caf1f863f140de1c1af51906e658c9fb7d7d6 (patch)
tree440889bf7622e7706e6bebe91d7d13ade83a89cc /lpcap.h
parentcc583a17df76a363e419c960d72422169fae816d (diff)
downloadlpeg-f53caf1f863f140de1c1af51906e658c9fb7d7d6.tar.gz
lpeg-f53caf1f863f140de1c1af51906e658c9fb7d7d6.tar.bz2
lpeg-f53caf1f863f140de1c1af51906e658c9fb7d7d6.zip
Avoid stack overflow when handling nested captures
The C code uses recursion to handle nested captures, so a too deep nesting could create a stack overflow. The fix limits the handling of nested captures to 'MAXRECLEVEL' (default is 200 levels).
Diffstat (limited to 'lpcap.h')
-rw-r--r--lpcap.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lpcap.h b/lpcap.h
index bf52b67..dc10d69 100644
--- a/lpcap.h
+++ b/lpcap.h
@@ -44,6 +44,7 @@ typedef struct CapState {
44 int ptop; /* index of last argument to 'match' */ 44 int ptop; /* index of last argument to 'match' */
45 const char *s; /* original string */ 45 const char *s; /* original string */
46 int valuecached; /* value stored in cache slot */ 46 int valuecached; /* value stored in cache slot */
47 int reclevel; /* recursion level */
47} CapState; 48} CapState;
48 49
49 50