1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
Description: Fix format string literals and avoid gcc error:
"format not a string literal and no format arguments
[-Werror=format-security]"
Author: Mònica Ramírez Arceda <monica@debian.org>
Last-Update: 2014-09-10
--- src/xml_elem.c
+++ src/xml_elem.c
@@ -132,7 +132,7 @@
if (xmlTextReaderHasAttributes(reader))
{
int have_attr, first = 1;
- fprintf(stdout, "[");
+ fprintf(stdout, "%s", "[");
for (have_attr = xmlTextReaderMoveToFirstAttribute(reader);
have_attr;
have_attr = xmlTextReaderMoveToNextAttribute(reader))
@@ -141,15 +141,15 @@
*avalue = xmlTextReaderConstValue(reader);
char quote;
if (!first)
- fprintf(stdout, " and ");
+ fprintf(stdout, "%s", " and ");
first = 0;
quote = xmlStrchr(avalue, '\'')? '"' : '\'';
fprintf(stdout, "@%s=%c%s%c", aname, quote, avalue, quote);
}
- fprintf(stdout, "]");
+ fprintf(stdout, "%s", "]");
}
- fprintf(stdout, "\n");
+ fprintf(stdout, "%s", "\n");
}
else if (elOps.sort_uniq)
{
--- src/xml.c
+++ src/xml.c
@@ -145,7 +145,7 @@
fprintf(stderr, ", %s", error->str3);
}
}
- fprintf(stderr, "\n");
+ fprintf(stderr, "%s", "\n");
if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
@@ -168,7 +168,7 @@
}
#define CHECK_MEM(ret) if (!ret) \
- (fprintf(stderr, "out of memory\n"), exit(EXIT_INTERNAL_ERROR))
+ (fprintf(stderr, "%s", "out of memory\n"), exit(EXIT_INTERNAL_ERROR))
void*
xmalloc(size_t size)
@@ -444,7 +444,7 @@
if (*plen >= MAX_NS_ARGS)
{
- fprintf(stderr, "too many namespaces increase MAX_NS_ARGS\n");
+ fprintf(stderr, "%s", "too many namespaces increase MAX_NS_ARGS\n");
exit(EXIT_BAD_ARGS);
}
--- src/xml_trans.c
+++ src/xml_trans.c
@@ -168,7 +168,7 @@
if (*plen >= MAX_PARAMETERS)
{
- fprintf(stderr, "too many params increase MAX_PARAMETERS\n");
+ fprintf(stderr, "%s", "too many params increase MAX_PARAMETERS\n");
exit(EXIT_INTERNAL_ERROR);
}
@@ -197,7 +197,7 @@
{
if (xmlStrchr(string, '\''))
{
- fprintf(stderr,
+ fprintf(stderr, "%s",
"string parameter contains both quote and double-quotes\n");
exit(EXIT_INTERNAL_ERROR);
}
@@ -214,7 +214,7 @@
if (*plen >= MAX_PARAMETERS)
{
- fprintf(stderr, "too many params increase MAX_PARAMETERS\n");
+ fprintf(stderr, "%s", "too many params increase MAX_PARAMETERS\n");
exit(EXIT_INTERNAL_ERROR);
}
--- src/xml_edit.c
+++ src/xml_edit.c
@@ -339,7 +339,7 @@
xmlNodePtr node;
if (nodes->nodeTab[i] == (void*) doc && mode != 0) {
- fprintf(stderr, "The document node cannot have siblings.\n");
+ fprintf(stderr, "%s", "The document node cannot have siblings.\n");
exit(EXIT_INTERNAL_ERROR);
}
@@ -382,7 +382,7 @@
for (i = 0; i < nodes->nodeNr; i++)
{
if (nodes->nodeTab[i] == (void*) doc) {
- fprintf(stderr, "The document node cannot be renamed.\n");
+ fprintf(stderr, "%s", "The document node cannot be renamed.\n");
exit(EXIT_INTERNAL_ERROR);
}
xmlNodeSetName(nodes->nodeTab[i], BAD_CAST val);
@@ -399,12 +399,12 @@
for (i = nodes->nodeNr - 1; i >= 0; i--)
{
if (nodes->nodeTab[i] == (void*) doc) {
- fprintf(stderr, "The document node cannot be deleted.\n");
+ fprintf(stderr, "%s", "The document node cannot be deleted.\n");
exit(EXIT_INTERNAL_ERROR);
}
if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- fprintf(stderr, "FIXME: can't delete namespace nodes\n");
+ fprintf(stderr, "%s", "FIXME: can't delete namespace nodes\n");
exit(EXIT_INTERNAL_ERROR);
}
/* delete node */
@@ -426,12 +426,12 @@
for (i = 0; i < nodes->nodeNr; i++)
{
if (nodes->nodeTab[i] == (void*) doc) {
- fprintf(stderr, "The document node cannot be moved.\n");
+ fprintf(stderr, "%s", "The document node cannot be moved.\n");
exit(EXIT_INTERNAL_ERROR);
}
if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- fprintf(stderr, "FIXME: can't move namespace nodes\n");
+ fprintf(stderr, "%s", "FIXME: can't move namespace nodes\n");
exit(EXIT_INTERNAL_ERROR);
}
/* move node */
@@ -501,7 +501,7 @@
if (!res_to
|| res_to->type != XPATH_NODESET
|| res_to->nodesetval->nodeNr != 1) {
- fprintf(stderr, "move destination is not a single node\n");
+ fprintf(stderr, "%s", "move destination is not a single node\n");
continue;
}
edMove(doc, nodes, res_to->nodesetval->nodeTab[0]);
--- src/trans.c
+++ src/trans.c
@@ -104,7 +104,7 @@
{
char *catalogs = getenv("SGML_CATALOG_FILES");
if (catalogs == NULL)
- fprintf(stderr, "Variable $SGML_CATALOG_FILES not set\n");
+ fprintf(stderr, "%s", "Variable $SGML_CATALOG_FILES not set\n");
else
xmlLoadCatalogs(catalogs);
}
--- src/xml_pyx.c
+++ src/xml_pyx.c
@@ -82,9 +82,9 @@
/* DON'T modify the attributes array, ever. */
const xmlChar*** atts = &attributes;
- fprintf(stdout,"(");
+ fprintf(stdout, "%s", "(");
print_qname(prefix, localname);
- fprintf(stdout, "\n");
+ fprintf(stdout, "%s", "\n");
if (nb_attributes > 1) {
atts = calloc(nb_attributes, sizeof(*atts));
@@ -139,7 +139,7 @@
pyxEndElement(void *userData, const xmlChar *localname, const xmlChar *prefix,
const xmlChar *URI)
{
- fprintf(stdout,")");
+ fprintf(stdout, "%s", ")");
print_qname(prefix, localname);
putchar('\n');
}
@@ -147,7 +147,7 @@
void
pyxCharacterData(void *userData, const xmlChar *s, int len)
{
- fprintf(stdout, "-");
+ fprintf(stdout, "%s", "-");
SanitizeData(s, len);
putchar('\n');
}
@@ -159,7 +159,7 @@
{
fprintf(stdout,"?%s ",target);
SanitizeData(data, xmlStrlen(data));
- fprintf(stdout,"\n");
+ fprintf(stdout, "%s", "\n");
}
void
@@ -191,7 +191,7 @@
const xmlChar *name)
{
const xmlChar *p = name;
- fprintf (stdout, "&");
+ fprintf (stdout, "%s", "&");
/* Up to space is the name of the referenced entity */
while (*p && (*p != ' ')) {
putchar (*p);
@@ -205,11 +205,11 @@
{
fprintf(stdout, "D %s PUBLIC", name); /* TODO: re-check */
if (ExternalID == NULL)
- fprintf(stdout, " ");
+ fprintf(stdout, "%s", " ");
else
fprintf(stdout, " \"%s\"", ExternalID);
if (SystemID == NULL)
- fprintf(stdout, "\n");
+ fprintf(stdout, "%s", "\n");
else
fprintf(stdout, " \"%s\"\n", SystemID);
}
@@ -217,17 +217,17 @@
static void
pyxCommentHandler(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
{
- fprintf(stdout,"C");
+ fprintf(stdout, "%s", "C");
SanitizeData(value, xmlStrlen(value));
- fprintf(stdout,"\n");
+ fprintf(stdout, "%s", "\n");
}
static void
pyxCdataBlockHandler(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value, int len)
{
- fprintf(stdout,"[");
+ fprintf(stdout, "%s", "[");
SanitizeData(value, len);
- fprintf(stdout,"\n");
+ fprintf(stdout, "%s", "\n");
}
static void
--- src/xml_C14N.c
+++ src/xml_C14N.c
@@ -84,7 +84,7 @@
if(xpath_filename) {
xpath = load_xpath_expr(doc, xpath_filename);
if(xpath == NULL) {
- fprintf(stderr,"Error: unable to evaluate xpath expression\n");
+ fprintf(stderr, "%s", "Error: unable to evaluate xpath expression\n");
xmlFreeDoc(doc);
return(EXIT_BAD_FILE);
}
@@ -160,7 +160,7 @@
ret = run_c14n(argv[3], 0, 1, (argc > 4) ? argv[4] : NULL, list, nonet);
if(list != NULL) xmlFree(list);
} else {
- fprintf(stderr, "error: bad arguments.\n");
+ fprintf(stderr, "%s", "error: bad arguments.\n");
c14nUsage(argv[0], EXIT_BAD_ARGS);
}
@@ -275,7 +275,7 @@
ctx = xmlXPathNewContext(parent_doc);
if(ctx == NULL) {
- fprintf(stderr,"Error: unable to create new context\n");
+ fprintf(stderr, "%s", "Error: unable to create new context\n");
xmlFree(expr);
xmlFreeDoc(doc);
return(NULL);
@@ -301,7 +301,7 @@
*/
xpath = xmlXPathEvalExpression(expr, ctx);
if(xpath == NULL) {
- fprintf(stderr,"Error: unable to evaluate xpath expression\n");
+ fprintf(stderr, "%s", "Error: unable to evaluate xpath expression\n");
xmlFree(expr);
xmlXPathFreeContext(ctx);
xmlFreeDoc(doc);
@@ -323,11 +323,11 @@
int i;
if(nodes == NULL ){
- fprintf(stderr, "Error: no nodes set defined\n");
+ fprintf(stderr, "%s", "Error: no nodes set defined\n");
return;
}
- fprintf(stderr, "Nodes Set:\n-----\n");
+ fprintf(stderr, "%s", "Nodes Set:\n-----\n");
for(i = 0; i < nodes->nodeNr; ++i) {
if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
xmlNsPtr ns;
--- src/xml_escape.c
+++ src/xml_escape.c
@@ -94,7 +94,7 @@
buffer = (xmlChar *) \
xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
if (buffer == NULL) { \
- fprintf(stderr, "growing buffer error"); \
+ fprintf(stderr, "%s", "growing buffer error"); \
abort(); \
} \
}
@@ -129,7 +129,7 @@
buffer_size = 1000;
buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar));
if (buffer == NULL) {
- fprintf(stderr, "allocating buffer error");
+ fprintf(stderr, "%s", "allocating buffer error");
abort();
}
out = buffer;
--- src/xml_select.c
+++ src/xml_select.c
@@ -229,7 +229,7 @@
{
if (argv[i + 1][0] == '-')
{
- fprintf(stderr, "-E option requires argument <encoding> ex: (utf-8, unicode...)\n");
+ fprintf(stderr, "%s", "-E option requires argument <encoding> ex: (utf-8, unicode...)\n");
exit(EXIT_BAD_ARGS);
}
else
@@ -239,7 +239,7 @@
}
else
{
- fprintf(stderr, "-E option requires argument <encoding> ex: (utf-8, unicode...)\n");
+ fprintf(stderr, "%s", "-E option requires argument <encoding> ex: (utf-8, unicode...)\n");
exit(EXIT_BAD_ARGS);
}
@@ -308,7 +308,7 @@
if (strcmp(argv[start], "-t") != 0 &&
strcmp(argv[start], "--template") != 0)
{
- fprintf(stderr, "not at the beginning of template\n");
+ fprintf(stderr, "%s", "not at the beginning of template\n");
abort();
}
@@ -345,7 +345,7 @@
found_option:
if (newtarg == &OPT_SORT && (targ != &OPT_MATCH && targ != &OPT_SORT))
{
- fprintf(stderr, "sort(s) must follow match\n");
+ fprintf(stderr, "%s", "sort(s) must follow match\n");
exit(EXIT_BAD_ARGS);
}
else if (newtarg == &OPT_TEMPLATE)
@@ -363,7 +363,7 @@
{
node = node->parent;
if (node->_private != &OPT_IF) {
- fprintf(stderr, "else without if\n");
+ fprintf(stderr, "%s", "else without if\n");
exit(EXIT_BAD_ARGS);
}
}
@@ -463,9 +463,9 @@
if (templateEmpty)
{
- fprintf(stderr, "error in arguments:");
- fprintf(stderr, " -t or --template option must be followed by");
- fprintf(stderr, " --match or other options\n");
+ fprintf(stderr, "%s", "error in arguments:");
+ fprintf(stderr, "%s", " -t or --template option must be followed by");
+ fprintf(stderr, "%s", " --match or other options\n");
exit(EXIT_BAD_ARGS);
}
@@ -528,8 +528,8 @@
*/
if (t == 0)
{
- fprintf(stderr, "error in arguments:");
- fprintf(stderr, " no -t or --template options found\n");
+ fprintf(stderr, "%s", "error in arguments:");
+ fprintf(stderr, "%s", " no -t or --template options found\n");
exit(EXIT_BAD_ARGS);
}
|