clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
215 stars 72 forks source link

YANG string length validation of XML CDATA encoding not correct #280

Closed olofhagsand closed 2 years ago

olofhagsand commented 3 years ago

If an XML string is encoded with CDATA, the YANG length checks are not correct. Example, CDATA encoding of string "abc":

<rpc>
   <edit-config>
      <target><candidate/></target>
      <config>
      <len1 xmlns="urn:example:clixon"><![CDATA[abc]]></len1>
      </config>
   </edit-config>
</rpc>

The YANG string validate check computes the length of the string to 15 (eg strlen("<![CDATA[abc]]>") and not the correct length 3. This may to invalid validate of string lengths.

olofhagsand commented 2 years ago

After analysis, the issue is not valid as stated. CDATA as entered above should be treated as payload and therefore be included in the length