summaryrefslogtreecommitdiff
path: root/cmd/podman/pod_kill.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-12-25 11:51:06 -0700
committerEd Santiago <santiago@redhat.com>2019-12-26 16:50:21 -0700
commit40f55ca3fe06d2e5d0232c1f07911ea728fd1bc1 (patch)
tree53cbd52ac0e6afe56e29b00f24ec3a8217b30533 /cmd/podman/pod_kill.go
parentc759c3f78dcbbf5dec462a863ad25cd41a1707b7 (diff)
downloadpodman-40f55ca3fe06d2e5d0232c1f07911ea728fd1bc1.tar.gz
podman-40f55ca3fe06d2e5d0232c1f07911ea728fd1bc1.tar.bz2
podman-40f55ca3fe06d2e5d0232c1f07911ea728fd1bc1.zip
signal parsing - better input validation
The helper function we use for signal name mapping does not check for negative numbers nor invalid (too-high) ones. This can yield unexpected error messages: # podman kill -s -1 foo ERRO[0000] unknown signal "18446744073709551615" This PR introduces a small wrapper for it that: 1) Strips off a leading dash, allowing '-1' or '-HUP' as valid inputs; and 2) Rejects numbers <1 or >64 (SIGRTMAX) Also adds a test suite checking signal handling as well as ensuring that invalid signals are rejected by the command line. Fixes: #4746 Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'cmd/podman/pod_kill.go')
-rw-r--r--cmd/podman/pod_kill.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/podman/pod_kill.go b/cmd/podman/pod_kill.go
index 064946f72..9f696073d 100644
--- a/cmd/podman/pod_kill.go
+++ b/cmd/podman/pod_kill.go
@@ -6,7 +6,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
- "github.com/docker/docker/pkg/signal"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -60,7 +60,7 @@ func podKillCmd(c *cliconfig.PodKillValues) error {
if c.Signal != "" {
// Check if the signalString provided by the user is valid
// Invalid signals will return err
- sysSignal, err := signal.ParseSignal(c.Signal)
+ sysSignal, err := util.ParseSignal(c.Signal)
if err != nil {
return err
}