diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-02-21 12:35:08 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-02-21 12:35:08 -0800 |
commit | 758d406ede97ad627ab804ab049e77396d18746c (patch) | |
tree | 39e24776b768b780853e343eee7291b10fd47e5b /handler.c | |
parent | 5f79e1c60d4e057306cf0670683ffae4022ea163 (diff) |
Limit recurse depth when parsing mime messages.
Limit to 100 depth to prevent a crash due to stack overflow. If this
turns out to be too large (or small), I'll adjust it.
Diffstat (limited to 'handler.c')
-rw-r--r-- | handler.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1770,9 +1770,17 @@ int mutt_body_handler (BODY *b, STATE *s) int plaintext = 0; handler_t handler = NULL, encrypted_handler = NULL; int rc = 0; + static unsigned short recurse_level = 0; int oflags = s->flags; + if (recurse_level >= 100) + { + dprint (1, (debugfile, "mutt_body_handler: recurse level too deep. giving up!\n")); + return -1; + } + recurse_level++; + /* first determine which handler to use to process this part */ if (mutt_is_autoview (b)) @@ -1892,6 +1900,7 @@ int mutt_body_handler (BODY *b, STATE *s) } cleanup: + recurse_level--; s->flags = oflags | (s->flags & MUTT_FIRSTDONE); if (rc) { |