Check the socket isn't too long before copying it to prevent a seg fault.

This commit is contained in:
Daniel O'Connor 2012-06-22 21:47:30 +09:30
parent 80b972c455
commit 3a606b7d91

View File

@ -1206,6 +1206,9 @@ int overlay_mdp_client_init()
overlay_mdp_client_socket_path_len=strlen(overlay_mdp_client_socket_path)+1;
if(debug&DEBUG_IO) DEBUGF("MDP client socket name='%s'",overlay_mdp_client_socket_path);
}
if (overlay_mdp_client_socket_path_len > 104 - 1)
FATALF("MDP socket path too long (%d > %d)", overlay_mdp_client_socket_path_len, 104 - 1);
bcopy(overlay_mdp_client_socket_path,name.sun_path,
overlay_mdp_client_socket_path_len);
unlink(name.sun_path);