Commit 69bea44b authored by guilhem@mysql.com's avatar guilhem@mysql.com

Fix for BUG#4017 "mysql_real_connect buffer overflow"

parent 2e04da08
......@@ -1358,7 +1358,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
my_gethostbyname_r_free();
goto error;
}
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
memcpy(&sock_addr.sin_addr, hp->h_addr,
min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length));
my_gethostbyname_r_free();
}
sock_addr.sin_port = (ushort) htons((ushort) port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment