Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
netcontrol
0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch of Package netcontrol
From ad6ac1b9685d6340ee1f430eeec0bf800b4e5fa1 Mon Sep 17 00:00:00 2001 From: Clemens Famulla-Conrad <cfamullaconrad@suse.de> Date: Fri, 21 Jul 2023 15:57:42 +0200 Subject: [PATCH 1/2] xml-reader: fix xml_getc() and xml_ungetc() References: bsc#1213349 Upstream: yes diff --git a/src/xml-reader.c b/src/xml-reader.c index ca7f820..e5e9587 100644 --- a/src/xml-reader.c +++ b/src/xml-reader.c @@ -70,7 +70,7 @@ typedef enum { typedef struct xml_reader { const char * filename; FILE * file; - char * buffer; + unsigned char * buffer; unsigned int no_close : 1; @@ -107,8 +107,8 @@ static void xml_debug(const char *, ...); static int xml_reader_init_file(xml_reader_t *xr, FILE *fp); static int xml_reader_open(xml_reader_t *xr, const char *filename); static int xml_reader_destroy(xml_reader_t *xr); -static char xml_getc(xml_reader_t *xr); -static void xml_ungetc(xml_reader_t *xr, char cc); +static int xml_getc(xml_reader_t *xr); +static void xml_ungetc(xml_reader_t *xr, int cc); /* * Document reader implementation @@ -463,7 +463,7 @@ xml_token_type_t xml_get_token_initial(xml_reader_t *xr, nc_stringbuf_t *res) { xml_token_type_t token; - char cc; + int cc; restart: /* Eat initial white space and store it in @res */ @@ -551,7 +551,7 @@ restart: xml_token_type_t xml_get_token_tag(xml_reader_t *xr, nc_stringbuf_t *res) { - char cc, oc; + int cc, oc; xml_skip_space(xr, NULL); @@ -632,8 +632,7 @@ error: xml_token_type_t xml_skip_comment(xml_reader_t *xr) { - int match = 0; - char cc; + int match = 0, cc; if (xml_getc(xr) != '-') { xml_parse_error(xr, "Unexpected <!-...> element"); @@ -668,7 +667,7 @@ int xml_expand_entity(xml_reader_t *xr, nc_stringbuf_t *res) { nc_stringbuf_t entity = NC_STRINGBUF_INIT; - char cc, expanded; + int cc, expanded; if(nc_stringbuf_grow(&entity, 128) < 0) { xml_parse_error(xr, "Unable to allocate entity buffer"); @@ -680,7 +679,7 @@ xml_expand_entity(xml_reader_t *xr, nc_stringbuf_t *res) xml_parse_error(xr, "Unexpenced EOF in entity"); return 0; } - if (isspace(cc)) + if (isspace((unsigned int)cc)) continue; nc_stringbuf_putc(&entity, cc); } @@ -720,7 +719,7 @@ good: void xml_skip_space(xml_reader_t *xr, nc_stringbuf_t *result) { - char cc; + int cc; while ((cc = xml_getc(xr)) != EOF) { if (!isspace(cc)) { @@ -863,10 +862,10 @@ xml_reader_destroy(xml_reader_t *xr) return rv; } -char +int xml_getc(xml_reader_t *xr) { - char cc; + int cc; while (1) { if (xr->pos) { @@ -883,17 +882,17 @@ xml_getc(xml_reader_t *xr) break; } - if (fgets(xr->buffer, XML_READER_BUFSZ, xr->file) == NULL) + if (fgets((char *)xr->buffer, XML_READER_BUFSZ, xr->file) == NULL) break; - xr->pos = (unsigned char *) xr->buffer; + xr->pos = xr->buffer; } return EOF; } void -xml_ungetc(xml_reader_t *xr, char cc) +xml_ungetc(xml_reader_t *xr, int cc) { if (xr->pos == NULL || xr->pos == (unsigned char *) xr->buffer -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor