* No space after ampersand escaped characters in XML https://github.com/clicon/clixon/issues/52

* Thanks @SCadilhac
This commit is contained in:
Olof hagsand 2018-10-29 21:41:16 +01:00
parent f273f52148
commit 7450eae046
5 changed files with 17 additions and 15 deletions

View file

@ -78,6 +78,8 @@
* Added command-line option `-t <timeout>` for clixon_netconf - quit after max time. * Added command-line option `-t <timeout>` for clixon_netconf - quit after max time.
### Corrected Bugs ### Corrected Bugs
* No space after ampersand escaped characters in XML https://github.com/clicon/clixon/issues/52
* Thanks @SCadilhac
* Single quotes for XML attributes https://github.com/clicon/clixon/issues/51 * Single quotes for XML attributes https://github.com/clicon/clixon/issues/51
* Thanks @SCadilhac * Thanks @SCadilhac
* Fixed https://github.com/clicon/clixon/issues/46 Issue with empty values in leaf-list * Fixed https://github.com/clicon/clixon/issues/46 Issue with empty values in leaf-list

View file

@ -395,7 +395,7 @@ xml_chardata_encode(char **escp,
else else
switch (str[i]){ switch (str[i]){
case '&': case '&':
if ((l=snprintf(&esc[j], 7, "&amp; ")) < 0){ if ((l=snprintf(&esc[j], 6, "&amp;")) < 0){
clicon_err(OE_UNIX, errno, "snprintf"); clicon_err(OE_UNIX, errno, "snprintf");
goto done; goto done;
} }
@ -407,14 +407,14 @@ xml_chardata_encode(char **escp,
cdata++; cdata++;
break; break;
} }
if ((l=snprintf(&esc[j], 6, "&lt; ")) < 0){ if ((l=snprintf(&esc[j], 5, "&lt;")) < 0){
clicon_err(OE_UNIX, errno, "snprintf"); clicon_err(OE_UNIX, errno, "snprintf");
goto done; goto done;
} }
j += l; j += l;
break; break;
case '>': case '>':
if ((l=snprintf(&esc[j], 6, "&gt; ")) < 0){ if ((l=snprintf(&esc[j], 5, "&gt;")) < 0){
clicon_err(OE_UNIX, errno, "snprintf"); clicon_err(OE_UNIX, errno, "snprintf");
goto done; goto done;
} }