Menu

#25 getword loop protection+system sort failure check

closed-fixed
nobody
None
5
2009-06-26
2009-03-03
No

Add a parameter to the getword function to specify the size of the output buffer. It prevents the getword function from happily smashing the stack when the stop character isn't found in the input string. On the other hand, it will report "getword loops" where it would otherwise have overflown the output buffer with unnoticeable effect (or not so unnoticeable effects).

The getword function now returns an error code that is processed by the caller to display the exact context into which the "getword loop" was found instead of always blaming the access.log file for any error found.

A new function getword_multisep processes the lines where the columns may be separated by more than one stop character.

The system calls to the sort program take the return status of the system call and report an error if the sorting failed. The opening of the sorted file was also moved when possible to try to open the sorted file before the input file is unlinked. If sort fails, the input file is left to investigate on the reason of the failure.

The size of some string buffers was increased to accommodate the size of the fields where "getword loop" were reported.

In index.c, the html trailer was written after the file handle was closed.

I'm sorry to mix several unrelated things in one patch but I had to make all these changes to get a running version of sarg and be able to validate anything.

Discussion

  • Nobody/Anonymous

    ur fix not work

    #make
    authfail.o: In function `authfail_report':
    /sarg-2.2.5/authfail.c:68: undefined reference to `WIFEXITED'
    /sarg-2.2.5/authfail.c:68: undefined reference to `WEXITSTATUS'
    /sarg-2.2.5/authfail.c:69: undefined reference to `WEXITSTATUS'
    /sarg-2.2.5/authfail.c:122: undefined reference to `getword_multisep'
    /sarg-2.2.5/authfail.c:122: undefined reference to `getword_multisep'
    /sarg-2.2.5/authfail.c:122: undefined reference to `getword_multisep'
    /sarg-2.2.5/authfail.c:122: undefined reference to `getword_multisep'
    /sarg-2.2.5/authfail.c:122: undefined reference to `getword_multisep'

     
  • Frederic Marchal

    You should look at the discussion starting at the third message of this thread:

    http://sourceforge.net/forum/forum.php?thread_id=3140276&forum_id=363374

    The getword_multisep error was due to a truncated patch file. The poster never explained the cause of the other error if he ever found a solution. You are welcome to provide more informations if you can.

     
  • Nobody/Anonymous

    tnks
    delete my comment plz

     
  • Frederic Marchal

    Fix truncation of the visited sites

     
  • Frederic Marchal

    The first patch was masking the visited sites. It would show the first word after the site name as the site name.

    The patch file has been updated to fix this issue.

     
  • Frederic Marchal

    • status: open --> closed-fixed
     

Log in to post a comment.