127 m_error = String ("recvfrom error: ") + strerror (errno); |
127 m_error = String ("recvfrom error: ") + strerror (errno); |
128 |
128 |
129 return false; |
129 return false; |
130 } |
130 } |
131 |
131 |
|
132 if (length < 4) |
|
133 { |
|
134 m_error = "The server sent a too short packet"; |
|
135 return false; |
|
136 } |
|
137 |
132 unsigned char decodedPacket[MAX_DATAGRAM_LENGTH]; |
138 unsigned char decodedPacket[MAX_DATAGRAM_LENGTH]; |
133 int decodedLength = sizeof decodedPacket; |
139 int decodedLength = sizeof decodedPacket; |
134 HUFFMAN_Decode (reinterpret_cast<unsigned char*> (HuffmanBuffer), |
140 HUFFMAN_Decode (reinterpret_cast<unsigned char*> (HuffmanBuffer), |
135 decodedPacket, length, &decodedLength); |
141 decodedPacket, length, &decodedLength); |
136 datagram.address.host = ntohl (claddr.sin_addr.s_addr); |
142 datagram.address.host = ntohl (claddr.sin_addr.s_addr); |