Sfoglia il codice sorgente

Escape control and nonprintable characters in docker ps

The docker ps command displays the user-entered command running in a container.
If that command contained \n, \t, or other control characters, they were
interpreted literally, and newlines and tabs would be printed in the output.
Escape the command string to make things more readable.

Docker-DCO-1.1-Signed-off-by: Matt Heon <mheon@redhat.com> (github: mheon)
Matthew Heon 11 anni fa
parent
commit
f55fa8211b
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  1. 1 0
      api/client/commands.go

+ 1 - 0
api/client/commands.go

@@ -1476,6 +1476,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
 				outCommand = out.Get("Command")
 				outCommand = out.Get("Command")
 				ports      = engine.NewTable("", 0)
 				ports      = engine.NewTable("", 0)
 			)
 			)
+			outCommand = strconv.Quote(outCommand)
 			if !*noTrunc {
 			if !*noTrunc {
 				outCommand = utils.Trunc(outCommand, 20)
 				outCommand = utils.Trunc(outCommand, 20)
 			}
 			}