Source: system-tools-backends
Version: 2.10.2-2
Severity: normal
Tags: upstream patch

Dear Maintainer,

In the function apply_ntp_date, from the module NTP, a misuse of
variables prevents the list of servers from being initialized correctly
when the the parameter @config is empty.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'stable-updates'), (500, 'testing'), 
(500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.3.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
diff --git a/Time/NTP.pm b/Time/NTP.pm
index 026ba3e..f2184a2 100644
--- a/Time/NTP.pm
+++ b/Time/NTP.pm
@@ -149,15 +149,13 @@ sub set_ntp_servers
 sub apply_ntp_date
 {
   my ($config) = @_;
-  my ($servers, $server);
+  my $servers;
 
-  foreach $server (@$config) {
-      $servers .= " $server";
-  }
+  $servers = join " ", @$config;
 
-  if ($server eq "") {
+  if ($servers eq "") {
       # There are no servers, pick them from the ntp.org pool
-      $server = "0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org";
+      $servers = "0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org";
   }
 
   # run ntpdate, this will only be effective

Reply via email to