BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

{bb} BBRELAY bug in bbd.c (BTF 1.9h)



Hi Brothers,
 
Is anyone using the BBELAY feature?
 
I am using BB BTF bb1.9h.
 
I noticed that after adding the following simple line
to my bb-hosts, messages were no longer being received
from any other hosts!
 
1.2.3.4  relayer.mydomain.com # BBDISPLAY BBRELAY:5.6.7.8
 
I traced this problem to a simple bug in bbd.c.
 
To fix, in bbd.c:
 
* Insert the following at line 1190:
  msgbuf_relay_varlen = sizeof(msgbuf_relay);
* For consistency change the storage class of variable msgbuf_relay to static
  by adding static keyword to definition of msgbuf_relay at line 708.
* Remove unused variable newmsgbuf, defined at line 707.
* Remove unused variable newmsgbuf_varlen, defined at line 711.
 
Summary of prior misbehavior:
 
At least on my Linux Fedora Core 4 system,
with a debug build I think the compiler was nice enough to insert code
to initialize msgbuf_relay_varlen to 0.
I think this would result in something similar to the following call at line 1265:
 strncpy (msgbuf_relay,msgbuf, 0xFFFFFFFF); // (!)
I imagine that with some compilers msgbuf_relay_varlen could remain uninitialized,
in which case the resulting behavior would be unknown.
 
Although I do not know the implementation of strncpy in the runtime library,
the effect was that the child processes forked to handle each incoming message died.
 
Has anyone fixed these problems already?
 
I think if BBRELAY worked, you were lucky that msgbuf_relay_varlen happened to contain
an in-range value!
 
Should I submit these simple changes to some authority?
 
Thanks,
Mark
Mark Buxbaum
Senior Software Engineer
Digital Strata

Home | Main Index | Thread Index