Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] missing strndup

2013-09-05 by manu@...

Johann Klasek <johann@...> wrote:

> (probably we'll hear "submit a patch" from Manu soon ;) )

It will rather be "get it from CVS or wait next release"

Index: milter-greylist.c
===================================================================
RCS file: /cvsroot/milter-greylist/milter-greylist.c,v
retrieving revision 1.269
retrieving revision 1.270
diff -U 4 -r1.269 -r1.270
--- milter-greylist.c   1 Sep 2013 04:59:42 -0000       1.269
+++ milter-greylist.c   4 Sep 2013 23:58:30 -0000       1.270
@@ -3800,14 +3800,16 @@
                }
 
                src = priv->priv_sr.sr_msg_x;
                for (i = 0; i < lcount; i++) {
-                       if ((lbufs[i] = strndup(src, MAXREPLYLEN)) == NULL) {
+                       if ((lbufs[i] = malloc(MAXREPLYLEN + 1)) == NULL) {
                                mg_log(LOG_ERR, "strndup failed: %s",
                                       strerror(errno));
                                exit(EX_OSERR);
                        }
 
+                       (void)strncpy(lbufs[i], src, MAXREPLYLEN);
+
                        src += MAXREPLYLEN;             
                }
 
                lbufs[i] = NULL;


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.