Procedure FD_Clr(fd:longint;var fds:fdSet);{$ifdef useinline}inline;{$endif}\r
{ Remove fd from the set of filedescriptors}\r
begin\r
- if (fd < 0) then raise exception.create('FD_Clr fd out of range: '+inttostr(fd));\r
+ if (fd < 0) or ((fd shr fdwordshift) > high(fdset)) then raise exception.create('FD_Clr fd out of range: '+inttostr(fd));\r
fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] and (not (1 shl (fd and fdwordmaxbit)));\r
end;\r
\r
Procedure FD_Set(fd:longint;var fds:fdSet);{$ifdef useinline}inline;{$endif}\r
{ Add fd to the set of filedescriptors }\r
begin\r
- if (fd < 0) then raise exception.create('FD_set fd out of range: '+inttostr(fd));\r
+ if (fd < 0) or ((fd shr fdwordshift) > high(fdset)) then raise exception.create('FD_set fd out of range: '+inttostr(fd));\r
fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] or (1 shl (fd and fdwordmaxbit));\r
end;\r
\r
Function FD_IsSet(fd:longint;var fds:fdSet):boolean;{$ifdef useinline}inline;{$endif}\r
{ Test if fd is part of the set of filedescriptors }\r
begin\r
- if (fd < 0) then begin\r
+ if (fd < 0) or ((fd shr fdwordshift) > high(fdset)) then begin\r
result := false;\r
exit;\r
end;\r