X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsisendt.c;h=81a3be64a3f8c7f653dd249337c9c1fe3354d49b;hb=4919b11a06c3c96652121922c010c31f27471756;hp=20cf7b3a326d97d8de3554ef552c53e0eeba97d3;hpb=ec88d3c0563eeb6ae5f73427edb0b3c4d7acf299;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sisendt.c b/src/rmr/si/src/si95/sisendt.c index 20cf7b3..81a3be6 100644 --- a/src/rmr/si/src/si95/sisendt.c +++ b/src/rmr/si/src/si95/sisendt.c @@ -25,10 +25,11 @@ * Abstract: This module contains various send functions: * SIsendt -- send tcp with queuing if would block * SIsendt_nq - send tcp without queuing if blocking - +* * Date: 27 March 1995 * Author: E. Scott Daniels * Mod: 22 Feb 2002 - To better process queued data +* 14 Feb 2020 - To fix index bug if fd < 0. * ***************************************************************************** */ @@ -57,6 +58,10 @@ extern int SIsendt( struct ginfo_blk *gptr, int fd, char *ubuf, int ulen ) { errno = EINVAL; gptr->sierr = SI_ERR_SESSID; + if( fd < 0 ) { + return SI_ERROR; // bad form trying to use this fd + } + if( fd < MAX_FDS ) { // straight from map if possible tpptr = gptr->tp_map[fd]; } else { @@ -100,6 +105,8 @@ extern int SIsendt( struct ginfo_blk *gptr, int fd, char *ubuf, int ulen ) { errno = EBUSY; status = SI_ERR_BLOCKED; } + } else { + errno = EBADFD; // fd in a bad state (probably losed) } return status;