Skip to content

Commit b33a12e

Browse files
authored
[fix] resolve potential attack in linker connection building (#6752)
1 parent 53e0ddf commit b33a12e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/network/linkers_socket.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ void Linkers::ListenThread(int incoming_cnt) {
157157
}
158158
int* ptr_in_rank = reinterpret_cast<int*>(buffer);
159159
int in_rank = *ptr_in_rank;
160+
if (in_rank < 0 || in_rank >= num_machines_) {
161+
Log::Fatal("Invalid rank %d found during initialization of linkers. The world size is %d.", in_rank, num_machines_);
162+
}
160163
// add new socket
161164
SetLinker(in_rank, handler);
162165
++connected_cnt;

0 commit comments

Comments
 (0)