Bug 168926 - Second '59.xxx' out of range 0..59 at security/snort-rep line 1084
Summary: Second '59.xxx' out of range 0..59 at security/snort-rep line 1084
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Stefan Walter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-10 19:00 UTC by Filip Valder
Modified: 2013-05-01 10:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Valder 2012-06-10 19:00:22 UTC
Perl's timelocal function doesn't accept nanoseconds. I used int()
function in order to make it work.

Fix: 

# convert to unix time
-    $a{timestamp} = timelocal($6, $5, $4, $2, $1 - 1, $year);
+    $a{timestamp} = timelocal(int($6), $5, $4, $2, $1 - 1, $year);
     $start_time = $a{timestamp}
       if not defined $start_time or $a{timestamp} < $start_time;
     $end_time = $a{timestamp} if not defined $end_time or $a{timestamp} > $end_time;--iAbtEPFWQ74ZKfc4ct9vkaU7jgrwFaSf0HXRV2bo0Mv87YPy
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- /usr/local/bin/snort-rep    2012-06-10 18:48:52.000000000 +0200
+++ /usr/local/bin/snort-rep    2012-06-10 19:14:13.000000000 +0200
@@ -1081,7 +1081,7 @@
     my $year = defined $3 ? $3 : (localtime(time))[5]+1900;
How-To-Repeat: Configure alert_fast output in snort.conf and wait till there's a record
with a 59.xxx (sec) timestamp. Analyze it using snort-rep and...

The error is:
Second '59.xxx' out of range 0..59 at ./snort-rep line 1084
Comment 1 Stefan Walter freebsd_committer freebsd_triage 2013-05-01 09:44:40 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Take.
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-05-01 10:02:58 UTC
Author: stefan
Date: Wed May  1 09:02:50 2013
New Revision: 317005
URL: http://svnweb.freebsd.org/changeset/ports/317005

Log:
  - Fix a call of Perl's timelocal() for timestamps with seconds out of [0..59].
    [1]
  - Convert Makefile header to new style.
  
  PR:		168926 [1]
  Submitted by:	Filip Valder <filip@valder.cz> [1]

Added:
  head/security/snort-rep/files/
  head/security/snort-rep/files/patch-snort-rep   (contents, props changed)
Modified:
  head/security/snort-rep/Makefile   (contents, props changed)

Modified: head/security/snort-rep/Makefile
==============================================================================
--- head/security/snort-rep/Makefile	Wed May  1 08:46:39 2013	(r317004)
+++ head/security/snort-rep/Makefile	Wed May  1 09:02:50 2013	(r317005)
@@ -1,12 +1,9 @@
-# New ports collection makefile for:	snort-rep
-# Date created:			Jul 19, 2001
-# Whom:				Mark Pulford <mark@kyne.com.au>
-#
+# Created by: Mark Pulford <mark@kyne.com.au>
 # $FreeBSD$
-#
 
 PORTNAME=	snort-rep
 PORTVERSION=	1.10
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	http://david.schweikert.ch/software/snort-rep/pub/
 

Added: head/security/snort-rep/files/patch-snort-rep
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/snort-rep/files/patch-snort-rep	Wed May  1 09:02:50 2013	(r317005)
@@ -0,0 +1,11 @@
+--- snort-rep.orig	2013-05-01 10:38:51.000000000 +0200
++++ snort-rep	2013-05-01 10:39:27.000000000 +0200
+@@ -1081,7 +1081,7 @@
+     my $year = defined $3 ? $3 : (localtime(time))[5]+1900;
+ 
+     # convert to unix time
+-    $a{timestamp} = timelocal($6, $5, $4, $2, $1 - 1, $year);
++    $a{timestamp} = timelocal(int($6), $5, $4, $2, $1 - 1, $year);
+     $start_time = $a{timestamp}
+       if not defined $start_time or $a{timestamp} < $start_time;
+     $end_time = $a{timestamp} if not defined $end_time or $a{timestamp} > $end_time;
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Stefan Walter freebsd_committer freebsd_triage 2013-05-01 10:03:35 UTC
State Changed
From-To: open->closed

Committed, thanks! (Since this doesn't seem to be a FreeBSD-specific problem, 
please consider sending the bugfix to the upstream maintainer/author of the 
software.)