diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-05-07 07:29:52 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-07-05 07:54:28 +1000 |
| commit | ec1696960982464ead78efcaa0406c71d8acc12d (patch) | |
| tree | edca1ef620e4472697971b30e71d5ff343c96759 /src/context.hh | |
| parent | 3b9818c10b6f3c6fd19aa90115c4c3e14dc2d236 (diff) | |
Do not reparse %sh{...} strings
Automatic reparsing of %sh{...}, while convenient in many cases,
can be surprising as well, and can lead to security problems:
'echo %sh{ printf "foo\necho bar" }' runs 'echo foo', then 'echo bar'.
we make this danger explicit, and we fix the 'nop %sh{...}' pattern.
To reparse %sh{...} strings, they can be passed to evaluate-commands,
which has been fixed to work in every cases where %sh{...} reparsing
was used..
Diffstat (limited to 'src/context.hh')
| -rw-r--r-- | src/context.hh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/context.hh b/src/context.hh index f4562cf3..dfbd855c 100644 --- a/src/context.hh +++ b/src/context.hh @@ -159,10 +159,11 @@ private: struct ScopedEdition { ScopedEdition(Context& context) - : m_context(context), m_buffer(&context.buffer()) - { m_context.begin_edition(); } + : m_context{context}, + m_buffer{context.has_buffer() ? &context.buffer() : nullptr} + { if (m_buffer) m_context.begin_edition(); } - ~ScopedEdition() { m_context.end_edition(); } + ~ScopedEdition() { if (m_buffer) m_context.end_edition(); } Context& context() const { return m_context; } private: |
