Hi!

I'm a new dspam user. I've read a bit the mailing list archive and I've
seen there is a problem with cssstat which segfault.

I think I found the problem which has been introduced by commit
f0dad778a48237e801d52f958c1eb1398893e52e.

-      rec = map.addr+filepos;
+      rec = map.addr;
+      rec += filepos;

In the second form, rec = map.addr + filepos * sizeof (*rec).

Same problem with:
-    header = map.addr + filepos;
+    header = map.addr;
+    header += filepos;

patch attached.
diff --git a/src/tools.hash_drv/cssstat.c b/src/tools.hash_drv/cssstat.c
index dcf7ae2..72b186f 100644
--- a/src/tools.hash_drv/cssstat.c
+++ b/src/tools.hash_drv/cssstat.c
@@ -53,7 +53,7 @@
 #   endif
 #endif
 
-int DO_DEBUG 
+int DO_DEBUG
 #ifdef DEBUG
 = 1
 #else
@@ -65,7 +65,7 @@ int DO_DEBUG
 #include "hash_drv.h"
 #include "language.h"
 #include "error.h"
- 
+
 #define SYNTAX "syntax: cssstat [filename]"
 
 int cssstat(const char *filename);
@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
     fprintf(stderr, "%s\n", SYNTAX);
     exit(EXIT_FAILURE);
   }
-   
+
   agent_config = read_config(NULL);
   if (!agent_config) {
     LOG(LOG_ERR, ERR_AGENT_READ_CONFIG);
@@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
   filename = argv[1];
 
   r = cssstat(filename);
-  
+
   if (r) {
     fprintf(stderr, "cssstat failed on error %d\n", r);
     exit(EXIT_FAILURE);
@@ -123,7 +123,7 @@ int cssstat(const char *filename) {
   if (READ_ATTRIB("HashMaxSeek"))
      max_seek = strtol(READ_ATTRIB("HashMaxSeek"), NULL, 0);
 
-  if (_hash_drv_open(filename, &map, 0, max_seek, 
+  if (_hash_drv_open(filename, &map, 0, max_seek,
                      max_extents, extent_size, 0, flags))
   {
     return EFAILURE;
@@ -137,8 +137,7 @@ int cssstat(const char *filename) {
       (unsigned long) header->hash_rec_max);
     efree = eused = 0;
     for(i=0;i<header->hash_rec_max;i++) {
-      rec = map.addr;
-      rec += filepos;
+      rec = map.addr + filepos;
       if (rec->hashcode) {
         eused++;
         nused++;
@@ -148,8 +147,7 @@ int cssstat(const char *filename) {
       }
       filepos += sizeof(struct _hash_drv_spam_record);
     }
-    header = map.addr;
-    header += filepos;
+    header = map.addr + filepos;
     filepos += sizeof(struct _hash_drv_header);
     extents++;
 
Regards.
-- 
Benoit Izac
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to