On Tue, 30 Nov 2004, Gisle Vanem wrote:

> Simply running "openvpn -h" causes a SIGSEGV. I was hoping '-h' would 
> print the help, but obviously not. Happens with '-v' too.

Interesting bug.

Basically "openvpn -h" is incorrect usage and should produce a basic
options parsing error message, and in fact it does this on *nix, but
crashes as you noted on Windows (openvpn --help will print the help).

The crash traces back to a simple incompatibility between win
and *nix.  On Windows, socket descriptors are unsigned, on *nix they are 
signed.  Commonly, -1 is used to denote an unopened file descriptor, but 
OpenVPN made the mistake of assuming that (fd >= 0) is sufficient to test 
for a valid fd.  If fd == -1, then (fd >= 0) is only true if fd is a 
signed type (yeah C is crazy, if you say "unsigned int fd = -1;" then test
for fd > 0, the test will be true).

Because of the way the new management interface works on beta18, any early 
fatal error messages (such as due to command line option errors) will 
trigger this bug.

I will fix for beta19.

James

Reply via email to