Hajimu UMEMOTO <ume@...> wrote:
> How about this patch? It allocates a memory for a sender address and
> a recipient address for autowhite, except and pending lists. Instead,
> ADDRLEN is enlarged to 127 to handle input string well, and to guard
> against very large address in milter-greylist.c, conf_yacc.y and
> dump_yacc.y.
Instead of 127, what about using the maximum limits here? RFC 821
suggests 64 chars for mailbox and 64 chars for domain name. Plus the '@'
and optionnal quotes around the mailbox, that makes 131. Was it
obsoleted by a newer RFC? I recall a limit of 1024 on the domain name,
but I can't find updated documentation.
> --- pending.c.orig Wed Aug 4 06:56:07 2004
> +++ pending.c Mon Sep 13 02:56:50 2004
> @@ -134,10 +134,21 @@ pending_get(sa, salen, from, rcpt, date)
> pending = NULL;
> goto out;
> }
> - strncpy(pending->p_from, from, ADDRLEN);
> - pending->p_from[ADDRLEN] = '\0';
> - strncpy(pending->p_rcpt, rcpt, ADDRLEN);
> - pending->p_rcpt[ADDRLEN] = '\0';
> + if ((pending->p_from = strdup(from)) == NULL) {
> + free(pending->p_addr);
> + free(pending->p_sa);
> + free(pending);
> + pending = NULL;
> + goto out;
> + }
> + if ((pending->p_rcpt = strdup(rcpt)) == NULL) {
> + free(pending->p_from);
> + free(pending->p_addr);
> + free(pending->p_sa);
> + free(pending);
> + pending = NULL;
> + goto out;
> + }
Is there any reason for not sipply panic (ie: display an error and exit)
here?
Otherwise, looks great.
--
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent
le binaire et ceux qui ne le comprennent pas.
manu@...Message
Re: [milter-greylist] cutting off sender-string
2004-09-12 by manu@netbsd.org
Attachments
- No local attachments were found for this message.