Improve heuristic for packetlogger file format detection.

svn path=/trunk/; revision=28809
This commit is contained in:
Michael Tüxen 2009-06-22 12:13:12 +00:00
parent 2f2c22c0c0
commit 5562e6e8cf
1 changed files with 2 additions and 4 deletions

View File

@ -70,10 +70,8 @@ int packetlogger_open(wtap *wth, int *err, gchar **err_info _U_)
file_read(&type, 1, 1, wth->fh);
/* Verify this file belongs to us */
if(!((pl_hdr.len & 0xFFFF0000) == 0 && (type < 0x04 ||
type == 0xFB ||
type == 0xFE ||
type == 0xFF)))
if (!((8 <= pl_hdr.len) && (pl_hdr.len < 65536) &&
(type < 0x04 || type == 0xFB || type == 0xFE || type == 0xFF)))
return 0;
/* No file header. Reset the fh to 0 so we can read the first packet */