X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/03b75b4c964d8b3ac97d4007f0e033549b01c92f..8bc22a17b97149d69fd377f5e9f5ed617a4385db:/fd_utils.pas?ds=inline diff --git a/fd_utils.pas b/fd_utils.pas index 290eb05..86b6d3a 100644 --- a/fd_utils.pas +++ b/fd_utils.pas @@ -48,7 +48,7 @@ uses sysutils; Procedure FD_Clr(fd:longint;var fds:fdSet);{$ifdef useinline}inline;{$endif} { Remove fd from the set of filedescriptors} begin - if (fd < 0) then raise exception.create('FD_Clr fd out of range: '+inttostr(fd)); + if (fd < 0) or ((fd shr fdwordshift) > high(fdset)) then raise exception.create('FD_Clr fd out of range: '+inttostr(fd)); fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] and (not (1 shl (fd and fdwordmaxbit))); end; @@ -61,14 +61,14 @@ end; Procedure FD_Set(fd:longint;var fds:fdSet);{$ifdef useinline}inline;{$endif} { Add fd to the set of filedescriptors } begin - if (fd < 0) then raise exception.create('FD_set fd out of range: '+inttostr(fd)); + if (fd < 0) or ((fd shr fdwordshift) > high(fdset)) then raise exception.create('FD_set fd out of range: '+inttostr(fd)); fds[fd shr fdwordshift]:=fds[fd shr fdwordshift] or (1 shl (fd and fdwordmaxbit)); end; Function FD_IsSet(fd:longint;var fds:fdSet):boolean;{$ifdef useinline}inline;{$endif} { Test if fd is part of the set of filedescriptors } begin - if (fd < 0) then begin + if (fd < 0) or ((fd shr fdwordshift) > high(fdset)) then begin result := false; exit; end;