| Bug #7402 | null-pointer exception | ||
|---|---|---|---|
| Submitted: | 18 Dec 2004 11:59 | Modified: | 5 Jan 2005 13:36 |
| Reporter: | Dietrich Teickner | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Query Browser | Severity: | S1 (Critical) |
| Version: | 1.1.2 | OS: | Windows (win32) |
| Assigned to: | CPU Architecture: | Any | |
[20 Dec 2004 9:30]
Hartmut Holzgraefe
gethostbyname() returns NULL on errors so this should indeed be checked for
[5 Jan 2005 13:36]
Michael G. Zinner
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html

Description: Hi, I have in mysql-query-browser-1.1.2\mysql-gui-common\library\source\myx_network.c a null-pointer exception. It was not checked the validyti of the returned pointer from gethostbyname(hostname). int myx_get_ip_as_string(const char *hostname, char *ip) { #if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) struct in_addr in; #endif struct hostent *phostent; phostent= gethostbyname(hostname); -----------------------> here is the poiner some time zero. !!!!!!!!!!!!! #if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) in.S_un.S_un_b.s_b1= phostent->h_addr_list[0][0]; in.S_un.S_un_b.s_b2= phostent->h_addr_list[0][1]; in.S_un.S_un_b.s_b3= phostent->h_addr_list[0][2]; in.S_un.S_un_b.s_b4= phostent->h_addr_list[0][3]; sprintf(ip, "%s", inet_ntoa(in)); #else strcpy(ip, inet_ntoa(*(struct in_addr*)phostent->h_addr_list[0])); #endif return 0; } I find some more situations in myx_network.c where dose never checked the returned pointer of gethostbyname. How to repeat: It is a problem in the source !!