Menu

#583 Strings created by EncodeHex are not null-terminated

Unstable
closed-accepted
Player (393)
5
2010-06-02
2010-05-27
No

The function EncodeHex in server/drivers/encode.cc does not null-terminate the c-strings it writes.

This in itself might just be unfavorable design and not a bug, but the writelog driver in WriteLog::WriteCamera assumes this string to be null-terminated. This leads to writelog writing strings for images that are too long (appending junk until a \0 is found), which in turn leads to ReadLog failing the assertion in ReadLog::ParseCamera:1530 once such a corrupted logfile is replayed.

The only other usage of EncodeHex seems to be in WriteLog::WriteRFID, where the whole string is properly set to \0 before calling EncodeHex.

Discussion

  • Sebastian Scherer

    patch EncodeHex to null-terminate its strings

     
  • G Biggs

    G Biggs - 2010-06-02

    The changes have been made in SVN trunk.
    Thank you for your contribution.

     
  • G Biggs

    G Biggs - 2010-06-02
    • status: open --> closed-accepted
     

Log in to post a comment.