diff --git a/CHANGES b/CHANGES index a2e63b8d1c..850ca693f2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,13 @@ +4.1.0-dev.316 | 2021-03-10 13:00:27 +0000 + + * 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. (Johanna Amann, Corelight) + 4.1.0-dev.314 | 2021-03-08 18:28:22 -0800 * new "opt" btest alternative (Vern Paxson, Corelight) diff --git a/VERSION b/VERSION index 6d66a9a401..99ca693f60 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.0-dev.314 +4.1.0-dev.316 diff --git a/src/analyzer/protocol/file/File.cc b/src/analyzer/protocol/file/File.cc index 6324246cbe..63b1a61193 100644 --- a/src/analyzer/protocol/file/File.cc +++ b/src/analyzer/protocol/file/File.cc @@ -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 )