fix unbounded read
This commit is contained in:
@@ -256,13 +256,13 @@ func parseTopicMessageCommand(c *cli.Context) (topic string, message string, com
|
|||||||
message = c.String("message")
|
message = c.String("message")
|
||||||
}
|
}
|
||||||
if message == "" && isStdinRedirected() {
|
if message == "" && isStdinRedirected() {
|
||||||
var bytes []byte
|
var data []byte
|
||||||
bytes, err = io.ReadAll(c.App.Reader)
|
data, err = io.ReadAll(io.LimitReader(c.App.Reader, 1024*1024))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug("Failed to read from stdin: %s", err.Error())
|
log.Debug("Failed to read from stdin: %s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message = strings.TrimSpace(string(bytes))
|
message = strings.TrimSpace(string(data))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user