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

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
modules/markup/html.go

index c2e574e3b29f56407d330dff574d1e8730d61d9a..b462b6b34b6e2eb370bbd786ca099f33d793592f 100644 (file)
@@ -312,7 +312,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>")