Hi Steve,

Spot on. Just committed the fix to GitHub code with credits to you:

https://github.com/pmacct/pmacct/commit/7afe854b627a31de764d1567038181e2eec16640

Thanks,
Paolo

On Wed, Aug 23, 2017 at 08:03:08AM -0400, Stephen Clark wrote:
> Hi Paolo,
> 
> After doing some more investigation this looks like this could be the problem.
> From cfg.h
> /* global vars */
> EXT char *cfg[SRVBUFLEN],
> 
> From cfg.c
>       while (!feof(file)) {
>         if (rows == LARGEBUFLEN) {
>       Log(LOG_ERR, "ERROR: [%s] maximum number of %d lines reached.\n",
> filename, LARGEBUFLEN);
> 
> Shouldn't *cfg[SRVBUFLEN] be *cfg[LARGEBUFLEN] ?
> 
> It looks like there are not enough array elements to hold all the config item 
> we
> have.
> 
> Regards,
> Steve
> 
> On 08/22/2017 03:06 PM, Stephen Clark wrote:
> > Hi Paolo,
> >
> > We have a large nfacctd.conf file around 530 lines. When we try to
> > start nfacctd with the -F flag we get a segfault at line below.
> >
> >       /* splitting key, value and name */
> >       delim = strchr(cfg[index], ':');
> >       *delim = '\0';                           <<<<<<<<<
> >       key = cfg[index];
> >       value = delim+1;
> >
> >
> > I changed the code like below to avoid the segfault - note this happens on 
> > the
> > last line of the file.
> > Also we only get the segfault if we use the -F flag.
> >
> >       delim = strchr(cfg[index], ':');
> >       if (delim) {
> >           *delim = '\0';
> >           key = cfg[index];
> >           value = delim+1;
> >       } else {
> >           index++;
> >           continue;
> >       }
> >
> > Regards,
> > Steve
> >
> >
> >
> >
> > _______________________________________________
> > pmacct-discussion mailing list
> > http://www.pmacct.net/#mailinglists
> 
> 
> -- 
> 
> "They that give up essential liberty to obtain temporary safety, 
> deserve neither liberty nor safety."  (Ben Franklin)
> 
> "The course of history shows that as a government grows, liberty 
> decreases."  (Thomas Jefferson)
> 
> "Beer is proof God loves us and wants us to be happy!" (Ben Franklin)
> 




> _______________________________________________
> pmacct-discussion mailing list
> http://www.pmacct.net/#mailinglists


_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to