]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] html: prevent buffer overflow in entity decoding
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 20 May 2026 10:39:51 +0000 (11:39 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 20 May 2026 10:39:51 +0000 (11:39 +0100)
commit04fc040b5ce534c796878f802d531049e044dfc5
tree6ddb3212d77df095e5a1ff805ddf11d2df4d9afc
parent35df300dcc7c0e1748c4989d79968a6fd1136c0b
[Fix] html: prevent buffer overflow in entity decoding

decode_html_entitles_inplace works in place, relying on the
replacement never being longer than the source entity text. That
assumption does not hold for some short entity names that expand to
multi-codepoint replacements (e.g. nGt, nLt, nvap): when such an
entity sits at the very end of the buffer the named-entity memcpy
wrote a few bytes past the end.

Bounds-check the replacement against the remaining buffer before
copying, matching the existing numeric-entity path, and drop the
entity when it does not fit.
src/libserver/html/html_entities.cxx