summaryrefslogtreecommitdiff
path: root/source3/lib/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/packet.c')
-rw-r--r--source3/lib/packet.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/lib/packet.c b/source3/lib/packet.c
index ef28bf9f625..c14d1e51ec3 100644
--- a/source3/lib/packet.c
+++ b/source3/lib/packet.c
@@ -106,6 +106,11 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx)
int res;
fd_set r_fds;
+ if (ctx->fd < 0 || ctx->fd >= FD_SETSIZE) {
+ errno = EBADF;
+ return map_nt_error_from_unix(errno);
+ }
+
FD_ZERO(&r_fds);
FD_SET(ctx->fd, &r_fds);