public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] getrrdimage.cgi: Add default values to parameters
@ 2022-04-06 13:46 Leo-Andres Hofmann
  2022-04-06 17:07 ` Peter Müller
  0 siblings, 1 reply; 2+ messages in thread
From: Leo-Andres Hofmann @ 2022-04-06 13:46 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

Prevents "use of uninitialized value" warnings when the
CGI is called with broken undefined GET parameters.

Signed-off-by: Leo-Andres Hofmann <hofmann(a)leo-andres.de>
---
 html/cgi-bin/getrrdimage.cgi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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 = ("entropy.cgi", "hardwaregraphs.cgi", "media.cgi",
 my $uri = URI->new($ENV{'REQUEST_URI'});
 my %query = $uri->query_form;
 
-my $origin = lc $query{'origin'}; # lower case
-my $graph = $query{'graph'};
-my $range = lc $query{'range'}; # lower case
+my $origin = lc ($query{'origin'} // ''); # lower case
+my $graph = $query{'graph'} // '';
+my $range = lc ($query{'range'} // ''); # lower case
 
 # Check parameters
 unless(($origin =~ /^\w+?\.cgi$/) && ($graph =~ /^[\w\-.,; ]+?$/) && ($range ~~ @Graphs::time_ranges)) {
-- 
2.27.0.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] getrrdimage.cgi: Add default values to parameters
  2022-04-06 13:46 [PATCH] getrrdimage.cgi: Add default values to parameters Leo-Andres Hofmann
@ 2022-04-06 17:07 ` Peter Müller
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Müller @ 2022-04-06 17:07 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

Reviewed-by: Peter Müller <peter.mueller(a)ipfire.org>

> Prevents "use of uninitialized value" warnings when the
> CGI is called with broken undefined GET parameters.
> 
> Signed-off-by: Leo-Andres Hofmann <hofmann(a)leo-andres.de>
> ---
>  html/cgi-bin/getrrdimage.cgi | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> 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 = ("entropy.cgi", "hardwaregraphs.cgi", "media.cgi",
>  my $uri = URI->new($ENV{'REQUEST_URI'});
>  my %query = $uri->query_form;
>  
> -my $origin = lc $query{'origin'}; # lower case
> -my $graph = $query{'graph'};
> -my $range = lc $query{'range'}; # lower case
> +my $origin = lc ($query{'origin'} // ''); # lower case
> +my $graph = $query{'graph'} // '';
> +my $range = lc ($query{'range'} // ''); # lower case
>  
>  # Check parameters
>  unless(($origin =~ /^\w+?\.cgi$/) && ($graph =~ /^[\w\-.,; ]+?$/) && ($range ~~ @Graphs::time_ranges)) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-06 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 13:46 [PATCH] getrrdimage.cgi: Add default values to parameters Leo-Andres Hofmann
2022-04-06 17:07 ` Peter Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox