Skip to content

Fix Null case in byte_stream constructor.#2

Open
ya1gaurav wants to merge 1 commit intokorczis:masterfrom
ya1gaurav:patch-1
Open

Fix Null case in byte_stream constructor.#2
ya1gaurav wants to merge 1 commit intokorczis:masterfrom
ya1gaurav:patch-1

Conversation

@ya1gaurav
Copy link

E.g:
xpath_processor::xpath_processor (
const TiXmlNode * XNp_source_tree, ///< Source XML tree
const char * cp_xpath_expr) ///< XPath expression
: xpath_stream (cp_xpath_expr)

While calling xpath_stream if cp_xpath_expr is NULL, then it will call byte_stream constructor which will crash in below line:
u_length = strlen (cp_in) + 1; // strlen(NULL) crashes the code.
So, Null handling done in byte_Stream.

E.g:
xpath_processor::xpath_processor (
   const TiXmlNode * XNp_source_tree,  ///< Source XML tree
   const char * cp_xpath_expr)         ///< XPath expression
      : xpath_stream (cp_xpath_expr)

While calling xpath_stream if cp_xpath_expr is NULL, then it will call byte_stream constructor which will crash in below line:
u_length = strlen (cp_in) + 1;  // strlen(NULL) crashes the code.
So, Null handling done in byte_Stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant