Bug Tracker item #2820558, was opened at 2009-07-13 05:47
Message generated for change (Comment added) made by sbajic
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2820558&group_id=250683

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: daemon
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dean Takemori (deantakemori)
>Assigned to: Stevan Bajic (sbajic)
Summary: Another hash_drv bug

Initial Comment:
in _ds_get_signature():

  if (fread(SIG->data, statbuf.st_size, 1, file) != statbuf.st_size) {

But man fread says:
       fread() and fwrite() return the number of items  successfully  read  or
       written  (i.e.,  not the number of characters).  If an error occurs, or
       the end-of-file is reached, the return value is a short item count  (or
       zero).

so the test should be < 1

----------------------------------------------------------------------

>Comment By: Stevan Bajic (sbajic)
Date: 2009-07-14 01:28

Message:
Hallo Dean

The 3th parameter for fread is used as count. So if statbuf.st_size * 1 is
not equal to the return value of fread then the file was not read
completely. statbuf.st_size is computed by using the stat syscall. Assuming
the file read by fread has 1024 bytes then fread should return 1024 as
result and 1024 * 1 = 1024 and every thing is fine. If fread returns -1 or
any other number not being 1024 then the fread was not successful and DSPAM
will bark about it. So how is that logic supposed to be wrong? Can you post
some examples where that if condition is triggering a bug?


Kind Regards

Stevan Bajic

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2820558&group_id=250683

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to