From 2bc430ad6900e3bfd35c991f6cc30d5ba6112403 Mon Sep 17 00:00:00 2001 From: "E. Scott Daniels" Date: Fri, 14 Feb 2020 09:31:48 -0500 Subject: [PATCH] Fix SI bug causing core dump sending to closed fd 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 Change-Id: I09b33bf1185aef609bfff058b272e1895eb1a29d --- CHANGES | 5 +++++ CMakeLists.txt | 2 +- src/rmr/si/src/si95/sisendt.c | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index fd918df..e41168b 100644 --- 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. diff --git a/CMakeLists.txt b/CMakeLists.txt index df07e8a..7e1efeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" ) diff --git a/src/rmr/si/src/si95/sisendt.c b/src/rmr/si/src/si95/sisendt.c index ae07edb..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 { -- 2.16.6