# HG changeset patch # User bears # Date 1045843288 0 # Node ID 9b79433f0976d4be544177a8e7c213747eb4902a # Parent eef64bccd0e2ad64e89f7ced2fac6abc39d0607b [svn] * src/content.c: Tighten up checks when accessing content vector. diff -r eef64bccd0e2 -r 9b79433f0976 src/content.c --- a/src/content.c Thu Feb 20 10:57:54 2003 +0000 +++ b/src/content.c Fri Feb 21 16:01:28 2003 +0000 @@ -1,7 +1,7 @@ /* content.c - $Id: content.c 413 2002-12-27 21:48:25Z bears $ + $Id: content.c 453 2003-02-21 16:01:28Z bears $ */ #if HAVE_CONFIG_H @@ -64,8 +64,11 @@ Bool Cont_validNumb( int n ) { + int ofs = n - cont.vecFirst; + return ( n != 0 && n >= cont.first && n <= cont.last - && cont.elem[ n - cont.vecFirst ] ); + && ofs >= 0 && ofs < cont.size + && cont.elem[ ofs ] != NULL ); } void @@ -88,7 +91,11 @@ int i; for ( i = 0; i < cont.size; ++i ) - del_Over( cont.elem[ i ] ); + { + if ( cont.elem[ i ] != NULL ) + del_Over( cont.elem[ i ] ); + cont.elem[ i ] = NULL; + } cont.size = 0; } @@ -172,7 +179,7 @@ /* Check for end article(s) being cancelled. Need to ensure we - don't re-use and article number. + don't re-use end article number. */ grpLast = Grp_last( name ); if ( cont.last < grpLast )