]> source.dussan.org Git - gitea.git/commitdiff
Fix another clusterfuzz identified issue (#15096) (#15113)
authorzeripath <art27@cantab.net>
Mon, 22 Mar 2021 19:16:08 +0000 (19:16 +0000)
committerGitHub <noreply@github.com>
Mon, 22 Mar 2021 19:16:08 +0000 (15:16 -0400)
Backport #15096

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
modules/markup/html.go

index a7d66cc2490a7c836e1cb85e0e69cd0af0228a2b..2ea0b56f727880a7148243941fc4011a861674e3 100644 (file)
@@ -327,7 +327,7 @@ func (ctx *postProcessCtx) postProcess(rawHTML []byte) ([]byte, error) {
        _, _ = res.WriteString("<html><body>")
 
        // Strip out nuls - they're always invalid
-       _, _ = nulCleaner.WriteString(res, string(tagCleaner.ReplaceAll(rawHTML, []byte("&lt;$1"))))
+       _, _ = res.Write(tagCleaner.ReplaceAll([]byte(nulCleaner.Replace(string(rawHTML))), []byte("&lt;$1")))
 
        // close the tags
        _, _ = res.WriteString("</body></html>")