Fix potential mime type detection bug in IRC/FTP file_transferred event

The files framework uses strncpy to copy data into the buffer that is
used for IRC/FTP mime type detection. From all I can tell that means
that, in these cases, currently mime type detection will be messed up if
the data being passed in contains zero bytes.
This commit is contained in:
Johanna Amann 2021-03-09 10:54:10 +00:00
parent f2d3bf3037
commit fa4d654a01

View file

@ -25,7 +25,7 @@ void File_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
if ( n )
{
strncpy(buffer + buffer_len, (const char*) data, n);
memcpy(buffer + buffer_len, (const char*) data, n);
buffer_len += n;
if ( buffer_len == BUFFER_SIZE )