|
From: Leif M. <le...@ta...> - 2003-04-16 04:01:20
|
Mike, Thanks lots of great info here. I had not heard of ElectricFence before. Once I got it setup I was able to locate the problem in about 10 minutes. :-D The 0 length malloc was being caused when there are no output filters configured. I now check for that so the Wrapper now passes ElectricFence without any warnings. Andy, could you please try building the MacOSX version again with the latest code from CVS? >But that turned up another issue. Efence spits out some text on >initialization, which means the first thing wrapper sees is '\n'. >Wrapper was not amused. I had to do the following patch: > I implemented this fix a little bit differently so there is not any duplicate code. But that was a definite bug. I was able to reproduce it by having a Java program output a single line feed before any other output. That has been in the code for quite a while. But still I am glad it is fixed. >First: in _C_, one should _NEVER_ cast the return value of malloc(). If >you get warnings without it, your ether your code or compiler is broken. > Ok, I went through and removed all of the casts. I am not sure exactly where I got in the habit of casting those. In my very early C days I remember having had some problems on a Solaris machine. I knew that it was not required with the compilers I was using, but wanted to make the code as portable as possible so I kept using them. >Second, if strings[i] contains an %, bad things can happen in the sprintf. > I had gone through a while back and modified the code to always use sprintf(buf, "%s", str) rather than sprintf(buf, str) in places that could contain % characters. strcpy is clearer so I made the change as you suggested. Thanks for the help with this. Leif |