bug 1159: Input validation for the time synchronsation on the signer bug-1159
authorMichael Tänzer <neo@nhng.de>
Tue, 9 Apr 2013 21:56:38 +0000 (23:56 +0200)
committerMichael Tänzer <neo@nhng.de>
Tue, 9 Apr 2013 21:56:38 +0000 (23:56 +0200)
Signed-off-by: Michael Tänzer <neo@nhng.de>
CommModule/server.pl

index c70bc9a..6084042 100755 (executable)
@@ -955,10 +955,10 @@ sub analyze($)
   if($bytes[1] == 0) # NUL Request
   {
     SysLog "NUL Request detected.\n";
-    if($fields[1])
+    if($fields[1] =~ /^\d+\.\d+$/)
     {
       open OUT,">timesync.sh";
-      print OUT "date -u $fields[1]\n";
+      print OUT "date -u '$fields[1]'\n";
       print OUT "hwclock --systohc\n";
       close OUT;
     }