Poorly hack in cdata parsing
Some checks are pending
Clixon CI / ubuntu-build (push) Waiting to run
Clixon CI / ubuntu-build-restconf-fcgi (push) Waiting to run
Clixon CI / docker-alpine-test-1 (push) Waiting to run
Clixon CI / docker-alpine-test-2 (push) Waiting to run
Clixon CI / docker-alpine-test-3 (push) Waiting to run
Clixon CI / docker-alpine-test-fcgi-r (push) Waiting to run
Some checks are pending
Clixon CI / ubuntu-build (push) Waiting to run
Clixon CI / ubuntu-build-restconf-fcgi (push) Waiting to run
Clixon CI / docker-alpine-test-1 (push) Waiting to run
Clixon CI / docker-alpine-test-2 (push) Waiting to run
Clixon CI / docker-alpine-test-3 (push) Waiting to run
Clixon CI / docker-alpine-test-fcgi-r (push) Waiting to run
This commit is contained in:
parent
e6eccd4431
commit
5513959eb4
1 changed files with 25 additions and 7 deletions
|
|
@ -530,6 +530,7 @@ xml_chardata_encode(char **escp,
|
||||||
len += strlen("&");
|
len += strlen("&");
|
||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
|
// <![CDATA[
|
||||||
if (strncmp(&str[i], "<![CDATA[", strlen("<![CDATA[")) == 0){
|
if (strncmp(&str[i], "<![CDATA[", strlen("<![CDATA[")) == 0){
|
||||||
len++;
|
len++;
|
||||||
cdata++;
|
cdata++;
|
||||||
|
|
@ -801,6 +802,7 @@ xml_chardata_decode(char **decp,
|
||||||
int j;
|
int j;
|
||||||
char ch;
|
char ch;
|
||||||
int ret;
|
int ret;
|
||||||
|
int cdata;
|
||||||
|
|
||||||
/* Two steps: (1) read in the complete format string */
|
/* Two steps: (1) read in the complete format string */
|
||||||
va_start(args, fmt); /* dryrun */
|
va_start(args, fmt); /* dryrun */
|
||||||
|
|
@ -824,18 +826,34 @@ xml_chardata_decode(char **decp,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
j = 0;
|
j = 0;
|
||||||
|
cdata = 0;
|
||||||
memset(dec, 0, slen+1);
|
memset(dec, 0, slen+1);
|
||||||
for (i=0; i<slen; i++){
|
for (i=0; i<slen; i++){
|
||||||
|
if (cdata) {
|
||||||
|
if ((i+2) < slen) && (strncmp(&str[i], "]]>", strlen("]]>")) == 0)){
|
||||||
|
cdata = 0;
|
||||||
|
i += 2;
|
||||||
|
} else {
|
||||||
|
dec[j++] = str[i];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
ch = str[i];
|
ch = str[i];
|
||||||
switch (ch){
|
switch (ch){
|
||||||
case '&':
|
case '&':
|
||||||
if ((ret = xml_chardata_decode_ampersand(&str[i+1], &ch, &i)) < 0)
|
if ((ret = xml_chardata_decode_ampersand(&str[i+1], &ch, &i)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
dec[j++] = str[i];
|
dec[j++] = str[i];
|
||||||
else
|
else
|
||||||
dec[j++] = ch;
|
dec[j++] = ch;
|
||||||
break;
|
break;
|
||||||
|
case '<':
|
||||||
|
if (strncmp(&str[i], "<![CDATA[", strlen("<![CDATA[")) == 0){
|
||||||
|
cdata++;
|
||||||
|
i += 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dec[j++] = str[i];
|
dec[j++] = str[i];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue