Skip to content

Commit

Permalink
[Server] Avoid SEGV when client issues an invalid sequence.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Aug 30, 2022
1 parent e803d26 commit f409b5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/XrdXrootd/XrdXrootdFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,15 @@ public:

inline XrdXrootdFile *Get(int fnum)
{if (fnum >= 0)
{if (fnum < XRD_FTABSIZE) return FTab[fnum];
if (XTab && (fnum-XRD_FTABSIZE)<XTnum)
return XTab[fnum-XRD_FTABSIZE];
{if (fnum < XRD_FTABSIZE)
{if (FTab[fnum] != heldSpotP) return FTab[fnum];
} else {
if (XTab)
{int i = fnum - XRD_FTABSIZE;
if (i < XTnum && XTab[i] != heldSpotP)
return XTab[i];
}
}
}
return (XrdXrootdFile *)0;
}
Expand Down
3 changes: 1 addition & 2 deletions src/XrdXrootd/XrdXrootdXeq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,7 @@ int XrdXrootdProtocol::do_Close()

// Find the file object
//
if (!FTab || !(fp = FTab->Get(fh.handle))
|| fp == XrdXrootdFileTable::heldSpotP)
if (!FTab || !(fp = FTab->Get(fh.handle)))
return Response.Send(kXR_FileNotOpen,
"close does not refer to an open file");

Expand Down

0 comments on commit f409b5b

Please sign in to comment.