Xymon Mailing List Archive search

bbtest-net crash: 4.2 RC with (fixed) all-in-one patch

3 messages in this thread

list John Payne · Mon, 7 Aug 2006 12:13:48 -0400 ·
I'm a new subscriber, been busy reading the archives.

First off... I don't think I saw this patch go through which fixes a  
problem exposed by the all-in-one patch:

*** hobbitd/hobbitd_alert.c.old Fri Aug  4 17:55:04 2006
--- hobbitd/hobbitd_alert.c     Fri Aug  4 17:55:16 2006
***************
*** 395,401 ****
                         namelist_t *hinfo;
                         int testdur = 0;
                         FILE *logfd = NULL;
!                       activealerts_t *awalk = NULL;;
                         int paramno = 0;

                         argi++; if (argi < argc) testhost = argv[argi];
--- 395,401 ----
                         namelist_t *hinfo;
                         int testdur = 0;
                         FILE *logfd = NULL;
!                       activealerts_t *awalk = NULL;
                         int paramno = 0;

                         argi++; if (argi < argc) testhost = argv[argi];


I also found an off by one error in bbtest-net.c:

*** bbnet/bbtest-net.c.old      Mon Aug  7 12:06:27 2006
--- bbnet/bbtest-net.c  Mon Aug  7 12:07:28 2006
***************
*** 1144,1150 ****
         }
         else {
                 /* parent */
!               char ip[IP_ADDR_STRLEN];

                 close(pfd[0]);
                 pingcount = 0;
--- 1144,1150 ----
         }
         else {
                 /* parent */
!               char ip[IP_ADDR_STRLEN+1];

                 close(pfd[0]);
                 pingcount = 0;


IP_ADDR_STRLEN is defined to be 16, but in start_ping_service, it's  
being used:

sprintf(ip, "%s\n", ip_to_test(t->host));

123.456.789.012 + \n + \0 is 17 characters.    Whenever I had a  
"full" IP address configured, bbtest-net would crash and burn.

The very simple patch above seems to have done the trick :)
list Henrik Størner · Mon, 7 Aug 2006 18:28:01 +0200 ·
quoted from John Payne
On Mon, Aug 07, 2006 at 12:13:48PM -0400, John Payne wrote:
I'm a new subscriber, been busy reading the archives.

First off... I don't think I saw this patch go through which fixes a  problem exposed by the all-in-one patch:

*** hobbitd/hobbitd_alert.c.old Fri Aug  4 17:55:04 2006
--- hobbitd/hobbitd_alert.c     Fri Aug  4 17:55:16 2006
I got this one just a few hours ago from another person, so it is
actually fixed already. 
quoted from John Payne
*** bbnet/bbtest-net.c.old      Mon Aug  7 12:06:27 2006
--- bbnet/bbtest-net.c  Mon Aug  7 12:07:28 2006

                /* parent */
!               char ip[IP_ADDR_STRLEN+1];
quoted from John Payne

IP_ADDR_STRLEN is defined to be 16, but in start_ping_service, it's  being used:

sprintf(ip, "%s\n", ip_to_test(t->host));
Good catch! Applied.


Thanks,
Henrik
list John Payne · Mon, 7 Aug 2006 12:32:00 -0400 ·
quoted from Henrik Størner
On Aug 7, 2006, at 12:28 PM, Henrik Stoerner wrote:
On Mon, Aug 07, 2006 at 12:13:48PM -0400, John Payne wrote:
I'm a new subscriber, been busy reading the archives.

First off... I don't think I saw this patch go through which fixes a
problem exposed by the all-in-one patch:

*** hobbitd/hobbitd_alert.c.old Fri Aug  4 17:55:04 2006
--- hobbitd/hobbitd_alert.c     Fri Aug  4 17:55:16 2006
I got this one just a few hours ago from another person, so it is
actually fixed already.
Ah... too slow!  I was chasing down the 2nd bug that was biting me so  
as to only send one report :p
quoted from Henrik Størner
*** bbnet/bbtest-net.c.old      Mon Aug  7 12:06:27 2006
--- bbnet/bbtest-net.c  Mon Aug  7 12:07:28 2006
                /* parent */
!               char ip[IP_ADDR_STRLEN+1];

IP_ADDR_STRLEN is defined to be 16, but in start_ping_service, it's
being used:

sprintf(ip, "%s\n", ip_to_test(t->host));
Good catch! Applied.
Excellent, thanks!