On 9/29/03 7:29 AM, "Gisle Vanem" <[EMAIL PROTECTED]> wrote:

> #define ioctlsocket(a,b,c)  ioctl((a),(b),*(int*)(c))
> 
> Can this really be right? I mean using it in BIO_socket_ioctl()
> expands to:
> ioctlsocket (fd, type, *(int*)ptr);
> 
> I would assume VxWorks to expect a pointer in the 3rd arg
> to it's ioctl(). If so, the above could crash or at worst silently
> trash some unrelated data.

I submitted a patch to cast it to an int instead of dereferencing it.
VxWorks ioctl takes an int for the 3 parameter, but it is treated similarly
to how other platforms treat the 3 parameter to ioctl (sometimes a pointer).
The original code for VxWorks in e_os.h was this (note the dereference of
"c"):

#define ioctlsocket(a,b,c)  ioctl((a),(b),*(c))

This did not compile because "c" is sometimes a void *. I changed it to the
following, which has difference semantics than the original (no longer
dereferences), but I think is correct for VxWorks (assumes an int is big
enough to hold a pointer, which is not always true on all platforms, but
this is a limitation of the VxWorks ioctl because it uses an int for that
parameter):

#define ioctlsocket(a,b,c)  ioctl((a),(b),(int)(c))

The latest version of e_os.h has the change.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to