From 6c5ebb728f871cf1ab1cd3ca4430d45a0e2a2375 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Mon, 25 Sep 2006 21:55:05 +0000 Subject: * generic/tclIO.c (Tcl_StackChannel): Fixed [SF Tcl Bug 1564642], aka coverity #51. Extended loop condition, added checking for NULL to prevent seg.fault. --- ChangeLog | 6 ++++++ generic/tclIO.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56b2e61..b11e06f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-25 Andreas Kupries + + * generic/tclIO.c (Tcl_StackChannel): Fixed [SF Tcl Bug 1564642], + aka coverity #51. Extended loop condition, added checking for + NULL to prevent seg.fault. + 2006-09-25 Andreas Kupries * generic/tclBasic.c: Reverted exposure of patchlevel in diff --git a/generic/tclIO.c b/generic/tclIO.c index 2eb96a7..407a88f 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.61.2.21 2006/07/10 23:01:06 hobbs Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.61.2.22 2006/09/25 21:55:06 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1323,7 +1323,7 @@ Tcl_StackChannel(interp, typePtr, instanceData, mask, prevChan) statePtr = (ChannelState *) tsdPtr->firstCSPtr; prevChanPtr = ((Channel *) prevChan)->state->topChanPtr; - while (statePtr->topChanPtr != prevChanPtr) { + while ((statePtr != NULL) && (statePtr->topChanPtr != prevChanPtr)) { statePtr = statePtr->nextCSPtr; } -- cgit v0.12