[libdazzle] tests: silence tainted input warning



commit a72a6166cbb8c70c5ed0d5c3eb6fdbd3bbe99438
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 10 16:21:48 2017 -0700

    tests: silence tainted input warning
    
    Validate arguments are valid UTF-8.

 tests/test-fuzzy-mutable-index.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/tests/test-fuzzy-mutable-index.c b/tests/test-fuzzy-mutable-index.c
index ac1da38..4e6b610 100644
--- a/tests/test-fuzzy-mutable-index.c
+++ b/tests/test-fuzzy-mutable-index.c
@@ -51,12 +51,18 @@ main (gint   argc,
 
      for (i = 1; i < argc; i++)
        {
+         const gchar *keyword;
          GArray *matches;
 
          g_printerr ("Searching for \"%s\"\n", argv [i]);
 
+         if (g_utf8_validate (argv[i], -1, NULL))
+           keyword = argv[i];
+         else
+           continue;
+
          begin = g_get_monotonic_time();
-         matches = dzl_fuzzy_mutable_index_match (fuzzy, argv[i], 0);
+         matches = dzl_fuzzy_mutable_index_match (fuzzy, keyword, 0);
          end = g_get_monotonic_time();
 
          g_array_sort (matches, compare_match);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]