From: keie Date: Fri, 11 Jan 1985 13:17:26 +0000 (+0000) Subject: The recursive call of setp1 initialized elements 0...ASIZE. X-Git-Tag: release-5-5~5783 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=22e4268cc70657b4fff4443a63f88a322201516e;p=ack.git The recursive call of setp1 initialized elements 0...ASIZE. This is out of bounds and now altered into 0..ASIZE-1. --- diff --git a/lang/cem/ctest/ctstruct/str.c b/lang/cem/ctest/ctstruct/str.c index 17884b64e..79fb2866e 100644 --- a/lang/cem/ctest/ctstruct/str.c +++ b/lang/cem/ctest/ctstruct/str.c @@ -16,6 +16,7 @@ */ /* Author: E.G. Keizer */ +static char rcs_id[]= "$Header$" ; /* test for structure parameters, assignment and return */ # define ASIZE 26 @@ -148,11 +149,11 @@ callt() { struct w3 setp1(count) { struct w3 myp ; - if ( count<0 ) { + if ( count<=0 ) { return(myp) ; } myp = setp1(count-1) ; - myp.w3_a[count] = 99-count ; + myp.w3_a[count-1] = 99-count ; return(myp) ; }