rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | From cc5ffe68438bef47c2313705afc0101eba640092 Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com> |
| 3 | Date: Thu, 23 Mar 2017 12:42:38 +0000 |
| 4 | Subject: [PATCH] search: fix compilation error with security flags enabled |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | | ../../grep-2.5.1a/src/search.c: In function 'dfaerror': |
| 10 | | ../../grep-2.5.1a/src/search.c:106:3: error: format not a string literal and no format arguments [-Werror=format-security] |
| 11 | | error (2, 0, mesg); |
| 12 | | ^~~~~ |
| 13 | |
| 14 | Upstream-Status: Inappropriate [required for grep 2.5.1a (GPLv2) recipe only] |
| 15 | Signed-off-by: André Draszik <adraszik@tycoint.com> |
| 16 | --- |
| 17 | src/search.c | 26 +++++++++++++------------- |
| 18 | 1 file changed, 13 insertions(+), 13 deletions(-) |
| 19 | |
| 20 | diff --git a/src/search.c b/src/search.c |
| 21 | index 3c6a485..9cee0d8 100644 |
| 22 | --- a/src/search.c |
| 23 | +++ b/src/search.c |
| 24 | @@ -103,7 +103,7 @@ check_utf8 (void) |
| 25 | void |
| 26 | dfaerror (char const *mesg) |
| 27 | { |
| 28 | - error (2, 0, mesg); |
| 29 | + error (2, 0, "%s", mesg); |
| 30 | } |
| 31 | |
| 32 | static void |
| 33 | @@ -142,7 +142,7 @@ kwsmusts (void) |
| 34 | continue; |
| 35 | ++kwset_exact_matches; |
| 36 | if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != 0) |
| 37 | - error (2, 0, err); |
| 38 | + error (2, 0, "%s", err); |
| 39 | } |
| 40 | /* Now, we compile the substrings that will require |
| 41 | the use of the regexp matcher. */ |
| 42 | @@ -151,10 +151,10 @@ kwsmusts (void) |
| 43 | if (dm->exact) |
| 44 | continue; |
| 45 | if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != 0) |
| 46 | - error (2, 0, err); |
| 47 | + error (2, 0, "%s", err); |
| 48 | } |
| 49 | if ((err = kwsprep (kwset)) != 0) |
| 50 | - error (2, 0, err); |
| 51 | + error (2, 0, "%s", err); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | @@ -198,7 +198,7 @@ Gcompile (char const *pattern, size_t size) |
| 56 | |
| 57 | if ((err = re_compile_pattern (motif, len, |
| 58 | &(patterns[pcount].regexbuf))) != 0) |
| 59 | - error (2, 0, err); |
| 60 | + error (2, 0, "%s", err); |
| 61 | pcount++; |
| 62 | |
| 63 | motif = sep; |
| 64 | @@ -286,7 +286,7 @@ Ecompile (char const *pattern, size_t size) |
| 65 | |
| 66 | if ((err = re_compile_pattern (motif, len, |
| 67 | &(patterns[pcount].regexbuf))) != 0) |
| 68 | - error (2, 0, err); |
| 69 | + error (2, 0, "%s", err); |
| 70 | pcount++; |
| 71 | |
| 72 | motif = sep; |
| 73 | @@ -755,7 +755,7 @@ fimb_fail: |
| 74 | if (wclen == 0) |
| 75 | { |
| 76 | if ((err = kwsincr (fimb_kwset, "", 0)) != 0) |
| 77 | - error (2, 0, err); |
| 78 | + error (2, 0, "%s", err); |
| 79 | } |
| 80 | else |
| 81 | for (i = 0; i < (1 << wclen); i++) |
| 82 | @@ -778,7 +778,7 @@ fimb_fail: |
| 83 | p += k; |
| 84 | } |
| 85 | if ((err = kwsincr (fimb_kwset, starts, p - starts)) != 0) |
| 86 | - error (2, 0, err); |
| 87 | + error (2, 0, "%s", err); |
| 88 | } |
| 89 | if (wclim < wcpattern + wcsize) |
| 90 | ++wclim; |
| 91 | @@ -790,7 +790,7 @@ fimb_fail: |
| 92 | free (starts); |
| 93 | Fimb.match = xmalloc (Fimb.count); |
| 94 | if ((err = kwsprep (kwset)) != 0) |
| 95 | - error (2, 0, err); |
| 96 | + error (2, 0, "%s", err); |
| 97 | return; |
| 98 | } |
| 99 | } |
| 100 | @@ -804,7 +804,7 @@ fimb_fail: |
| 101 | for (lim = beg; lim < pattern + size && *lim != '\n'; ++lim) |
| 102 | ; |
| 103 | if ((err = kwsincr (kwset, beg, lim - beg)) != 0) |
| 104 | - error (2, 0, err); |
| 105 | + error (2, 0, "%s", err); |
| 106 | if (lim < pattern + size) |
| 107 | ++lim; |
| 108 | beg = lim; |
| 109 | @@ -812,7 +812,7 @@ fimb_fail: |
| 110 | while (beg < pattern + size); |
| 111 | |
| 112 | if ((err = kwsprep (kwset)) != 0) |
| 113 | - error (2, 0, err); |
| 114 | + error (2, 0, "%s", err); |
| 115 | } |
| 116 | |
| 117 | #ifdef MBS_SUPPORT |
| 118 | @@ -1220,11 +1220,11 @@ Pcompile (char const *pattern, size_t size) |
| 119 | |
| 120 | cre = pcre_compile (re, flags, &ep, &e, pcre_maketables ()); |
| 121 | if (!cre) |
| 122 | - error (2, 0, ep); |
| 123 | + error (2, 0, "%s", ep); |
| 124 | |
| 125 | extra = pcre_study (cre, 0, &ep); |
| 126 | if (ep) |
| 127 | - error (2, 0, ep); |
| 128 | + error (2, 0, "%s", ep); |
| 129 | |
| 130 | free (re); |
| 131 | #endif |
| 132 | -- |
| 133 | 2.11.0 |
| 134 | |