Try the attached patch. It includes the change from size_t to off_t previously discussed and also clears up the unit tests on my 32-bit system; unfortunately I don't have a 64-bit system on which to test yet.
Index: dkim-canon.c
===================================================================
RCS file: /cvs/libdkim/dkim-canon.c,v
retrieving revision 1.17
diff -u -r1.17 dkim-canon.c
--- dkim-canon.c        8 Aug 2007 18:02:05 -0000       1.17
+++ dkim-canon.c        13 Aug 2007 13:17:16 -0000
@@ -616,7 +616,7 @@
 DKIM_STAT
 dkim_add_canon(DKIM *dkim, bool hdr, dkim_canon_t canon, int hashtype,
                u_char *hdrlist, struct dkim_header *sighdr,
-               size_t length, DKIM_CANON **cout)
+               off_t length, DKIM_CANON **cout)
 {
        DKIM_CANON *cur;
        DKIM_CANON *new;
@@ -1080,7 +1080,7 @@
 DKIM_STAT
 dkim_canon_bodychunk(DKIM *dkim, u_char *buf, size_t buflen)
 {
-       size_t remain;
+       off_t remain;
        u_int wlen;
        DKIM_CANON *cur;
        u_char *p;
@@ -1101,7 +1101,10 @@
                if (cur->canon_remain == 0)
                        continue;
 
-               remain = MIN(buflen, cur->canon_remain);
+               if (cur->canon_remain == (off_t) -1)
+                       remain = buflen;
+               else
+                       remain = MIN(buflen, cur->canon_remain);
 
                eob = buf + remain - 1;
                wrote = buf;
Index: dkim-canon.h
===================================================================
RCS file: /cvs/libdkim/dkim-canon.h,v
retrieving revision 1.3
diff -u -r1.3 dkim-canon.h
--- dkim-canon.h        2 Jul 2007 05:44:06 -0000       1.3
+++ dkim-canon.h        13 Aug 2007 13:17:16 -0000
@@ -18,7 +18,7 @@
 /* prototypes */
 extern DKIM_STAT dkim_add_canon __P((DKIM *, bool, dkim_canon_t, int,
                                      u_char *, struct dkim_header *,
-                                     size_t length, DKIM_CANON **cout));
+                                     off_t length, DKIM_CANON **cout));
 extern DKIM_STAT dkim_canon_bodychunk __P((DKIM *, u_char *, size_t));
 extern void dkim_canon_cleanup __P((DKIM *));
 extern DKIM_STAT dkim_canon_closebody __P((DKIM *));
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
dkim-milter-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dkim-milter-discuss

Reply via email to