Skip to content

Commit 94c0b05

Browse files
committedSep 26, 2024
BUG/MEDIUM: raw: sanitizer incorectly wrote config as a pointer addr
1 parent 542eb91 commit 94c0b05

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed
 

‎configuration/raw.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (c *client) PostRawConfiguration(config *string, version int64, skipVersion
180180

181181
w := bufio.NewWriter(tmp)
182182
if !skipVersionCheck {
183-
_, _ = w.WriteString(fmt.Sprintf("# _version=%v\n%v", version, c.dropVersionFromRaw(*config)))
183+
_, _ = w.WriteString(fmt.Sprintf("# _version=%d\n%s", version, c.dropVersionFromRaw(*config)))
184184
} else {
185185
_, _ = w.WriteString(*config)
186186
}
@@ -206,7 +206,7 @@ func (c *client) PostRawConfiguration(config *string, version int64, skipVersion
206206

207207
// dropVersionFromRaw is used when force pushing a raw configuration with version check:
208208
// if the provided user input has already a version metadata it must be withdrawn.
209-
func (c *client) dropVersionFromRaw(input string) *string {
209+
func (c *client) dropVersionFromRaw(input string) string {
210210
scanner := bufio.NewScanner(strings.NewReader(input))
211211

212212
var sanitized strings.Builder
@@ -222,9 +222,7 @@ func (c *client) dropVersionFromRaw(input string) *string {
222222
sanitized.WriteByte('\n')
223223
}
224224

225-
str := sanitized.String()
226-
227-
return &str
225+
return sanitized.String()
228226
}
229227

230228
func (c *client) validateConfigFile(confFile string) error {

0 commit comments

Comments
 (0)