From 507000a304b34850c358d75af3f6291ed444c8f6 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Tue, 14 Sep 2021 22:23:01 +0200 Subject: api: handle nil pointer dereference in rest endpoints When `?all=garbage` is passed to an API endpoint schema validation fails and err is nil. Wrapf uses err to create an error message causing a nil pointer dereference. Signed-off-by: Jelle van der Waa --- test/apiv2/20-containers.at | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/apiv2/20-containers.at') diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 8fdecb4bd..afff68c22 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -22,6 +22,10 @@ podman run $IMAGE true t GET libpod/containers/json 200 length=0 +# bad all input +t GET libpod/containers/json?all='garb1age' 500 \ + .cause="schema: error converting value for \"all\"" + t GET libpod/containers/json?all=true 200 \ length=1 \ .[0].Id~[0-9a-f]\\{64\\} \ -- cgit v1.2.3-54-g00ecf