Fix SI bug causing core dump sending to closed fd 18/2518/2 3.1.3
authorE. Scott Daniels <daniels@research.att.com>
Fri, 14 Feb 2020 14:31:48 +0000 (09:31 -0500)
committerE. Scott Daniels <daniels@research.att.com>
Fri, 14 Feb 2020 14:37:11 +0000 (09:37 -0500)
The SIsendt function was not properly checking the file descriptor
and could core dump when an attempt was made to send on a connection
that was closed.

Issue-ID: RIC-207

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I09b33bf1185aef609bfff058b272e1895eb1a29d

CHANGES
CMakeLists.txt
src/rmr/si/src/si95/sisendt.c

diff --git a/CHANGES b/CHANGES
index fd918df..e41168b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,11 @@
 API and build change  and fix summaries. Doc correctsions
 and/or changes are not mentioned here; see the commit messages.
 
+2020 February 14; version 3.1.3
+       Fix bug in SIsend which was causing a core dump in some cases
+       where the application attempted to send on a connection that
+       had disconnected. (RIC-207).
+
 2020 February 6; version 3.1.2
        Fix disconnection detection bug in interface to SI95.
 
index df07e8a..7e1efeb 100644 (file)
@@ -38,7 +38,7 @@ cmake_minimum_required( VERSION 3.5 )
 
 set( major_version "3" )               # should be automatically populated from git tag later, but until CI process sets a tag we use this
 set( minor_version "1" )
-set( patch_level "2" )
+set( patch_level "3" )
 
 set( install_root "${CMAKE_INSTALL_PREFIX}" )
 set( install_inc "include/rmr" )
index ae07edb..81a3be6 100644 (file)
 *  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 {