Re: [Quickfix-developers] Field with embedded null character
Brought to you by:
orenmnero
From: Caleb E. <cal...@gm...> - 2004-10-29 14:08:08
|
On Thu, 28 Oct 2004 16:54:46 -0400, Yihu Fang <yih...@re...> wrote: > Actually I am thinking what if a FIX engine sends a FIX message which > has embedded null character. After the message read off the socket > (which is a character array), the rest of the code is using STL string > to represent the message. A null character will basically truncate the > string. No, thats not correct. STL strings can contain \0 bytes. There are a couple of other bugs that are due to using char* buffers. In Parser.cpp, line 152 reads: m_buffer += m_readBuffer; This should be changed to: m_buffer.append (m_readBuffer, size); This fixes the sending side of things, but on the receive side, the ThreadedSocketConnection needs an overhaul to deal with data that could contain NUL bytes. The simplest change would probably be to use a Queue<std::pair<size_t, char*> > and just include the length along with each buffer. -- Caleb Epstein cal...@gm... |