mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
txscript: switch template engine from html/template to text/template
html/template automatically HTML-escapes special characters to prevent XSS, which can silently corrupt arbitrary script data. Since the output is binary script bytes and not HTML, this escaping provides no benefit and might breaks correctness.
This commit is contained in:
parent
cac334b6aa
commit
d36b9ded6d
1 changed files with 1 additions and 2 deletions
|
|
@ -5,9 +5,9 @@ import (
|
|||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
// ScriptTemplateOpt is a function type for configuring the script template.
|
||||
|
|
@ -103,7 +103,6 @@ func looksLikeInt(s string) bool {
|
|||
return len(s) > 0
|
||||
}
|
||||
|
||||
|
||||
// processScript converts the template output to actual script bytes. We scan
|
||||
// each line, then go through each element one by one, deciding to either add a
|
||||
// normal op code, a push data, or an integer value.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue