Re: [SPAM] Re: Small bug found

"Kai Risku" <[email protected]> Tue, 14 May 2013 20:31:00 +0300
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>
Nope, this is *not* windows, I found the bug on a linux machine (#if_NOT_def CRM_WINDOWS). 

BTW, your emails are raising all kinds of spam-alerts because there seem to be a piece of spam attached to the footer of your last two emails. Check the mail archives for evidence as I removed the crap in order to be able to reply.. :)

--
[email protected]     GSM  +358-40-767 8282
Oy Arrak Software Ab   http://www.arrak.fi

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
Sent: Tuesday, May 14, 2013 19:54
To: Kai Risku
Cc: [email protected]
Subject: [Crm114-general] [SPAM] Re: Small bug found

"Kai Risku" <[email protected]> writes:

Got it.  Interesting... and I never saw the bug because the whole
problem only happens in Windows and I don't have a Windows machine.

But yes, patch accepted.  Thanks!

   - Bill

<<< crm_markovian.c:717  CODE STARTS HERE>>>

  //    Because mmap/munmap doesn't set atime, nor set the "modified"           
  //    flag, some network filesystems will fail to mark the file as            
  //    modified and so their cacheing will make a mistake.                     
  //                                                                            
  //    The fix is to do a trivial read/write on the .css ile, to force         
  //    the filesystem to repropagate it's caches.                              
  //                                                                            
#ifndef CRM_WINDOWS
  {
    int hfd;                  //  hashfile fd                                   
    FEATURE_HEADER_STRUCT foo;
    hfd = open (&(htext[css_filename_start]), O_RDWR);
    dontcare = read (hfd, &foo, sizeof(foo));
    lseek (hfd, 0, SEEK_SET);
    dontcare = write (hfd, &foo, sizeof(foo));
    close (hfd);
  }
#endif  // !CRM_WINDOWS      

<<<CODE ENDS HERE >>>

> Markovian classifier tries to update the timestamp of the css file, but unfortunately has lost the filename to use. 
>
> Here is a patch:
>
>
> --- crm_markovian.c.orig        2013-05-13 12:51:52.000000000 +0300
> +++ crm_markovian.c     2013-05-13 12:53:15.000000000 +0300
> @@ -148,6 +148,8 @@
>    //             filename starts at i,  ends at j. null terminate it.
>    htext[j] = '\000';
>
> +  int filenameidx = i;
> +
>    //             and stat it to get it's length
>    k = stat (&htext[i], &statbuf);
>
> @@ -724,7 +726,7 @@
>    {
>      int hfd;                  //  hashfile fd
>      FEATURE_HEADER_STRUCT foo;
> -    hfd = open (&(htext[i]), O_RDWR);
> +    hfd = open (&(htext[filenameidx]), O_RDWR);
>      dontcare = read (hfd, &foo, sizeof(foo));
>      lseek (hfd, 0, SEEK_SET);
>      dontcare = write (hfd, &foo, sizeof(foo));
>
>
>
> --
> [email protected]     GSM  +358-40-767 8282
> Oy Arrak Software Ab   http://www.arrak.fi
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Crm114-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/crm114-general



------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d