Skip to content
  • David Kilzer's avatar
    Reserve byte for NUL terminator and report errors consistently in xmlBuf and xmlBuffer · 6ef16dee
    David Kilzer authored and Nick Wellnhofer's avatar Nick Wellnhofer committed
    This is a follow-up to commit 6c283d83.
    
    * buf.c:
    (xmlBufGrowInternal):
    - Call xmlBufMemoryError() when the buffer size would overflow.
    - Account for NUL terminator byte when using XML_MAX_TEXT_LENGTH.
    - Do not include NUL terminator byte when returning length.
    (xmlBufAdd):
    - Call xmlBufMemoryError() when the buffer size would overflow.
    
    * tree.c:
    (xmlBufferGrow):
    - Call xmlTreeErrMemory() when the buffer size would overflow.
    - Do not include NUL terminator byte when returning length.
    (xmlBufferResize):
    - Update error message in xmlTreeErrMemory() to be consistent
      with other similar messages.
    (xmlBufferAdd):
    - Call xmlTreeErrMemory() when the buffer size would overflow.
    (xmlBufferAddHead):
    - Add overflow checks similar to those in xmlBufferAdd().
    6ef16dee