Skip to content
Snippets Groups Projects
Commit bb5f95a0 authored by rswindell's avatar rswindell
Browse files

Fix bug whereby tags (e.g. "Fw:" and "SPAM:") were not being stripped from

subjects before hashing.
Some paranoia stuff (calling clearerr() just incase rewind() doesn't clear the
stream's EOF flag).
parent f25bcbe8
Branches
Tags
No related merge requests found
......@@ -63,6 +63,7 @@ int SMBCALL smb_findhash(smb_t* smb, hash_t** compare, hash_t* found_hash,
if(count && source_mask!=SMB_HASH_SOURCE_NONE) {
rewind(smb->hash_fp);
clearerr(smb->hash_fp);
while(!feof(smb->hash_fp)) {
if(smb_fread(smb,&hash,sizeof(hash),smb->hash_fp)!=sizeof(hash))
break;
......@@ -85,13 +86,13 @@ int SMBCALL smb_findhash(smb_t* smb, hash_t** compare, hash_t* found_hash,
continue; /* wrong pre-process flags */
if((compare[c]->flags&hash.flags&SMB_HASH_MASK)==0)
continue; /* no matching hashes */
if(compare[c]->flags&hash.flags&SMB_HASH_CRC16
if((compare[c]->flags&hash.flags&SMB_HASH_CRC16)
&& compare[c]->crc16!=hash.crc16)
continue; /* wrong crc-16 */
if(compare[c]->flags&hash.flags&SMB_HASH_CRC32
if((compare[c]->flags&hash.flags&SMB_HASH_CRC32)
&& compare[c]->crc32!=hash.crc32)
continue; /* wrong crc-32 */
if(compare[c]->flags&hash.flags&SMB_HASH_MD5
if((compare[c]->flags&hash.flags&SMB_HASH_MD5)
&& memcmp(compare[c]->md5,hash.md5,sizeof(hash.md5)))
continue; /* wrong MD5 */
......@@ -278,7 +279,7 @@ hash_t** SMBCALL smb_msghashes(smbmsg_t* msg, const uchar* body, long source_mas
}
break;
}
if((hash=smb_hashstr(msg->hdr.number, t, SMB_HASH_SOURCE_SUBJECT,flags, msg->subj))!=NULL)
if((hash=smb_hashstr(msg->hdr.number, t, SMB_HASH_SOURCE_SUBJECT, flags, p))!=NULL)
hashes[h++]=hash;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment