From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: Re: [PATCH] getrrdimage.cgi: Add default values to parameters Date: Wed, 06 Apr 2022 17:07:07 +0000 Message-ID: <7a21d6b9-91a2-bfaf-3ecc-16b34c7b9595@ipfire.org> In-Reply-To: <20220406134652.1506-1-hofmann@leo-andres.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1147004557782586171==" List-Id: --===============1147004557782586171== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Reviewed-by: Peter M=C3=BCller > Prevents "use of uninitialized value" warnings when the > CGI is called with broken undefined GET parameters. >=20 > Signed-off-by: Leo-Andres Hofmann > --- > html/cgi-bin/getrrdimage.cgi | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/html/cgi-bin/getrrdimage.cgi b/html/cgi-bin/getrrdimage.cgi > index 26e026bba..6ec91cc92 100644 > --- a/html/cgi-bin/getrrdimage.cgi > +++ b/html/cgi-bin/getrrdimage.cgi > @@ -44,9 +44,9 @@ my @supported_origins =3D ("entropy.cgi", "hardwaregraphs= .cgi", "media.cgi", > my $uri =3D URI->new($ENV{'REQUEST_URI'}); > my %query =3D $uri->query_form; > =20 > -my $origin =3D lc $query{'origin'}; # lower case > -my $graph =3D $query{'graph'}; > -my $range =3D lc $query{'range'}; # lower case > +my $origin =3D lc ($query{'origin'} // ''); # lower case > +my $graph =3D $query{'graph'} // ''; > +my $range =3D lc ($query{'range'} // ''); # lower case > =20 > # Check parameters > unless(($origin =3D~ /^\w+?\.cgi$/) && ($graph =3D~ /^[\w\-.,; ]+?$/) && (= $range ~~ @Graphs::time_ranges)) { --===============1147004557782586171==--