[gnome-games] utils: Fix options injection with custom filename
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] utils: Fix options injection with custom filename
- Date: Mon, 22 May 2017 13:30:22 +0000 (UTC)
commit f75e2bed9315621da7ced69219d20b7b3d75a0d6
Author: Michael Scherer <misc redhat com>
Date: Mon May 22 14:54:48 2017 +0200
utils: Fix options injection with custom filename
If a filename start by '--', grep would assume this is a option,
and so would potentially either miss the file, or wait
until STDIN is closed. A quick look at grep manpage do not
yield any way to execute code with this for now, but it is
better to fix the problem for now.
Using '--' is the traditional way to deal with file using
a double dash prefix.
Fix https://bugzilla.gnome.org/show_bug.cgi?id=782952
src/utils/grep.vala | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/utils/grep.vala b/src/utils/grep.vala
index f6f93e3..21a66ad 100644
--- a/src/utils/grep.vala
+++ b/src/utils/grep.vala
@@ -3,7 +3,7 @@
namespace Games.Grep {
public size_t[] get_offsets (string filename, string text) {
var working_dir = Environment.get_current_dir ();
- string[] args = { "grep", "--byte-offset", "--only-matching", "--text", text, filename };
+ string[] args = { "grep", "--byte-offset", "--only-matching", "--text", text, "--", filename
};
var env = Environ.@get ();
bool success = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]