Re: libmysqlclient crashing - SOLVED
Posted by: Antti Kutoja
Date: May 06, 2012 02:55AM
Turns out that the crash is related to my use of an obsolete call - gethostbyaddr()
I built the library that has this code some years ago...
I use the call to get the hostname of the new client. If the call actually can resolve a host name, I copy it into a control structure attached to the client connection. If the call cannot resolve, I copy the string "Unknown".
The memory I allocate to the hostname comes from the string lengths of a resolved name or "Unkown". If the host is "Unknown", the crash does not occur.
If I get a host name (hostent structure) I allocate based on the strlen of the hostname in that struct. Despite having exactly the right amount of memory allocated, somehow copying from the name in the hostent struct to the client's struct, the crash results when I subsequently try to connect to the MySQL DB.
I changed the code to get the client hostname using getnameinfo() and all the problems went away and the server is back in action.
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.