ccollins476ad commented on issue #5: cmd: img_mgmt: Add an extra byte to the 
'hash' buffer
URL: https://github.com/apache/mynewt-mcumgr/pull/5#issuecomment-401909191
 
 
   Thanks, Olivier.  This looks like a good workaround for the buffer overrun.
   
   The real bug seems to be in the TinyCbor implementation.  From 
`_cbor_value_copy_string`'s heading:
   ```
    * On success, this function sets the number of bytes copied to \c{*buflen}. 
If
    * the buffer is large enough, this function will insert a null byte after 
the
    * last copied byte, to facilitate manipulation of null-terminated strings.
    * That byte is not included in the returned value of \c{*buflen}.
   ```
   
   However, this particular bug is not in the official TinyCbor source 
(https://github.com/intel/tinycbor), and it is also not in the Mynewt fork.  I 
guess this bug must be an artifact from the original merge to Zephyr.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to