[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2.99.55 scheduler.conf parsing problem



On Thu, May 24, 2001 at 11:13:05PM +0100, Darryl Miles wrote:
> ************************************************************************
> --- zmailer-2.99.55/scheduler/readconfig.c~     Fri Feb 16 08:22:53 2001
> +++ zmailer-2.99.55/scheduler/readconfig.c      Thu May 24 23:04:50 2001
> @@ -407,6 +407,7 @@
> 
>  redo_readtoken:
>         if (lp == NULL) {
> +         memset (line, 0, sizeof line);
>           if (csfgets(line, sizeof line, fp) < 0)
>             return -1;
>           *linenump += 1;
> ************************************************************************

  Like you note, this is probably patching over the real problem...
  ... of not zero-terminating the string when encountering EOF at
  any other phase than at the very beginning of the line.

  xterm copy&paste from CVS diff -- probably TABs mangled ..

--- lib/cfgets.c        2000/10/16 11:32:39     1.3
+++ lib/cfgets.c        2001/05/25 04:18:21     1.4
@@ -39,6 +39,7 @@
          } else {
            if (cnt == 0)
              return EOF;
+           if (n > 0) *s = 0; /* Zero terminate it! */
            break;
          }
        }

  To think of it, that "fgets" seems to need a bit more poking,
  but I have to check its usage in the system at first (e.g.,
  if the input overflows the buffer, can it a) ignore the rest
  until end-of-line, or b) bail out after zero-terminating the
  maxsize-1 data is collected ...)

> -- 
> Darryl Miles
> Webtraffik Netbauds Ltd
> www.netbauds.net

-- 
/Matti Aarnio	<mea@nic.funet.fi>