[sysprof] cat: protect against writing binary to TTY
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] cat: protect against writing binary to TTY
- Date: Tue, 29 May 2018 23:06:50 +0000 (UTC)
commit cdd9a64177c074b2879c7258e07eb49f20bebfa5
Author: Christian Hergert <chergert redhat com>
Date: Tue May 29 16:05:17 2018 -0700
cat: protect against writing binary to TTY
tools/sysprof-cat.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/tools/sysprof-cat.c b/tools/sysprof-cat.c
index f7a1e12..b2e5ac8 100644
--- a/tools/sysprof-cat.c
+++ b/tools/sysprof-cat.c
@@ -115,6 +115,12 @@ main (gint argc,
if (argc == 1)
return 0;
+ if (isatty (STDOUT_FILENO))
+ {
+ g_printerr ("stdout is a TTY, refusing to write binary data to stdout.\n");
+ return EXIT_FAILURE;
+ }
+
for (guint i = 1; i < argc; i++)
{
if (!g_file_test (argv[i], G_FILE_TEST_IS_REGULAR))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]