Skip to content

Commit e025640

Browse files
committed
Fix a case of deleted memory modification
cnctAuth and port->port_srv_auth point to the same object so useResponse must not be assigned if the object is deleted.
1 parent 3bf526c commit e025640

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/remote/server/server.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,13 +1912,15 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
19121912
{
19131913
ConnectAuth* cnctAuth = FB_NEW ConnectAuth(port, id);
19141914
port->port_srv_auth = cnctAuth;
1915-
if (port->port_srv_auth->authenticate(send, ServerAuth::USE_COND_ACCEPT))
1915+
1916+
if (cnctAuth->authenticate(send, ServerAuth::USE_COND_ACCEPT))
19161917
{
1917-
delete port->port_srv_auth;
1918+
delete cnctAuth;
19181919
port->port_srv_auth = NULL;
19191920
}
1921+
else
1922+
cnctAuth->useResponse = true;
19201923

1921-
cnctAuth->useResponse = true;
19221924
return true;
19231925
}
19241926

0 commit comments

Comments
 (0)