From f8de4e03e9263e39d03455845ec2fc51fd99c6c7 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 4 Aug 2022 16:20:56 +0000 Subject: Validate size parameter is a number (to prevent shell injection problems) git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4393 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/pnmmargin | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'editor/pnmmargin') diff --git a/editor/pnmmargin b/editor/pnmmargin index 6b30c074..cfc5256e 100755 --- a/editor/pnmmargin +++ b/editor/pnmmargin @@ -67,6 +67,13 @@ fi size="$1" shift +case $size in + ''|*[!0-9]*) + echo "Size argument '$size' is not a whole number" + exit 1 + ;; +esac + if [ ${2-""} ] ; then echo "usage: $0 [-white|-black|-color ] [pnmfile]" 1>&2 exit 1 -- cgit 1.4.1