Fixed: [Using the characters '<' and '>' might cause an invalid diff](https://github.com/clicon/clixon-controller/issues/73)
This commit is contained in:
parent
574106125f
commit
4d91ce0995
3 changed files with 36 additions and 4 deletions
|
|
@ -15,6 +15,10 @@ Expected: February 2024
|
|||
|
||||
* Added reference count for shared yang-specs (schema mounts)
|
||||
|
||||
### Corrected Bugs
|
||||
|
||||
* Fixed: [Using the characters '<' and '>' might cause an invalid diff](https://github.com/clicon/clixon-controller/issues/73)
|
||||
|
||||
## 6.5.0
|
||||
6 December 2023
|
||||
|
||||
|
|
|
|||
|
|
@ -989,6 +989,8 @@ xml_diff2cbuf(cbuf *cb,
|
|||
yang_stmt *yc1;
|
||||
char *b0;
|
||||
char *b1;
|
||||
char *e0 = NULL;
|
||||
char *e1 = NULL;
|
||||
int eq;
|
||||
int nr=0;
|
||||
int level1;
|
||||
|
|
@ -1079,10 +1081,31 @@ xml_diff2cbuf(cbuf *cb,
|
|||
xml_diff_keys(cb, x0, y0, (level+1)*PRETTYPRINT_INDENT);
|
||||
nr++;
|
||||
}
|
||||
/* Encode data to XML */
|
||||
if (b0){
|
||||
if (xml_chardata_encode(&e0, "%s", b0) < 0)
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
e0 = NULL;
|
||||
if (b1){
|
||||
if (xml_chardata_encode(&e1, "%s", b1) < 0)
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
e1 = NULL;
|
||||
cprintf(cb, "-%*s%s>%s</%s>\n", ((level+1)*PRETTYPRINT_INDENT-1), "<",
|
||||
xml_name(x0c), b0, xml_name(x0c));
|
||||
xml_name(x0c), e0, xml_name(x0c));
|
||||
cprintf(cb, "+%*s%s>%s</%s>\n", ((level+1)*PRETTYPRINT_INDENT-1), "<",
|
||||
xml_name(x1c), b1, xml_name(x1c));
|
||||
xml_name(x1c), e1, xml_name(x1c));
|
||||
if (e0){
|
||||
free(e0);
|
||||
e0 = NULL;
|
||||
}
|
||||
if (e1){
|
||||
free(e1);
|
||||
e1 = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (xml_diff2cbuf(cb, x0c, x1c, level+1, 0) < 0)
|
||||
|
|
@ -1097,6 +1120,10 @@ xml_diff2cbuf(cbuf *cb,
|
|||
cprintf(cb, "%*s</%s>\n", level*PRETTYPRINT_INDENT, "", xml_name(x0));
|
||||
retval = 0;
|
||||
done:
|
||||
if (e0)
|
||||
free(e0);
|
||||
if (e1)
|
||||
free(e1);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ yang_schema_mount_point(yang_stmt *y)
|
|||
* @param[in] xpath Key for yspec on y
|
||||
* @param[out] yspec YANG stmt spec
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
yang_mount_get(yang_stmt *y,
|
||||
|
|
@ -159,6 +158,8 @@ yang_mount_get(yang_stmt *y,
|
|||
(cv = cvec_find(cvv, xpath)) != NULL &&
|
||||
yspec)
|
||||
*yspec = cv_void_get(cv);
|
||||
else
|
||||
*yspec = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +256,7 @@ xml_yang_mount_get(clicon_handle h,
|
|||
goto done;
|
||||
if (ret == 0)
|
||||
goto fail;
|
||||
if (yang_mount_get(y, xpath1, yspec) < 0)
|
||||
if (yspec && yang_mount_get(y, xpath1, yspec) < 0)
|
||||
goto done;
|
||||
retval = 1;
|
||||
done:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue