From 7bd5699ad855229c7a0a4d538cf330e9a1f34838 Mon Sep 17 00:00:00 2001 From: wxs Date: Thu, 10 Oct 2013 17:34:34 +0000 Subject: Fix an infinite loop in discogrok. PR: ports/182490 Submitted by: "Regis A. Despres" Obtained from: https://github.com/jordansissel/grok/commit/f1858bfa347bc79ad9aa6f3425edd3c19ffecf42 --- sysutils/grok/Makefile | 1 + sysutils/grok/files/patch-discover_main.c | 11 +++++++++++ sysutils/grok/files/patch-grok_discover.c | 12 ++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 sysutils/grok/files/patch-discover_main.c create mode 100644 sysutils/grok/files/patch-grok_discover.c (limited to 'sysutils') diff --git a/sysutils/grok/Makefile b/sysutils/grok/Makefile index 9acddb574bca..7929ddafc946 100644 --- a/sysutils/grok/Makefile +++ b/sysutils/grok/Makefile @@ -2,6 +2,7 @@ PORTNAME= grok PORTVERSION= 1.20110708.1 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= sysutils MASTER_SITES= GOOGLE_CODE diff --git a/sysutils/grok/files/patch-discover_main.c b/sysutils/grok/files/patch-discover_main.c new file mode 100644 index 000000000000..7875f999292c --- /dev/null +++ b/sysutils/grok/files/patch-discover_main.c @@ -0,0 +1,11 @@ +--- ./discover_main.c.orig 2013-10-10 13:25:59.000000000 -0400 ++++ ./discover_main.c 2013-10-10 13:26:13.000000000 -0400 +@@ -33,7 +33,7 @@ + grok_init(&grok); + + int pattern_count = 0; +- while ((opt = getopt_long_only(argc, argv, "hp:v", options, &optind)) != -1) { ++ while ((opt = getopt_long_only(argc, argv, "hp:v", options, NULL)) != -1) { + switch (opt) { + case 'h': + usage(); diff --git a/sysutils/grok/files/patch-grok_discover.c b/sysutils/grok/files/patch-grok_discover.c new file mode 100644 index 000000000000..000e7c2d0707 --- /dev/null +++ b/sysutils/grok/files/patch-grok_discover.c @@ -0,0 +1,12 @@ +--- ./grok_discover.c.orig 2013-10-10 13:26:22.000000000 -0400 ++++ ./grok_discover.c 2013-10-10 13:27:24.000000000 -0400 +@@ -187,6 +187,9 @@ + if (first_match_endpos > 0) { + offset += first_match_endpos; + } ++ else { ++ offset += 1; ++ } + } else { /* We found a match, replace it in the pattern */ + grok_log(gdt, LOG_DISCOVER, "%d: Matched %s on '%.*s'", + rounds, best_match.grok->pattern, -- cgit