Unverified Commit b33a12ea authored by shiyu1994's avatar shiyu1994 Committed by GitHub
Browse files

[fix] resolve potential attack in linker connection building (#6752)

parent 53e0ddf7
...@@ -157,6 +157,9 @@ void Linkers::ListenThread(int incoming_cnt) { ...@@ -157,6 +157,9 @@ void Linkers::ListenThread(int incoming_cnt) {
} }
int* ptr_in_rank = reinterpret_cast<int*>(buffer); int* ptr_in_rank = reinterpret_cast<int*>(buffer);
int in_rank = *ptr_in_rank; int in_rank = *ptr_in_rank;
if (in_rank < 0 || in_rank >= num_machines_) {
Log::Fatal("Invalid rank %d found during initialization of linkers. The world size is %d.", in_rank, num_machines_);
}
// add new socket // add new socket
SetLinker(in_rank, handler); SetLinker(in_rank, handler);
++connected_cnt; ++connected_cnt;
......
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