svn commit: r228663 - head/usr.sbin/lpr/filters

Dimitry Andric dim at FreeBSD.org
Sat Dec 17 21:50:59 UTC 2011


On 2011-12-17 22:44, Kostik Belousov wrote:
>>  #define MAXWIDTH  132
>>  #define MAXREP    10
>> @@ -115,7 +116,7 @@ main(int argc, char *argv[])
>>  			acctfile = cp;
>>  	}
>>  
>> -	for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' ');
>> +	memset(buf, ' ', sizeof(buf));
>>  	done = 0;
> buf is two-dimensional array. This change looks wrong.

The for loop took the address of the left-top corner of the
two-dimensional array, and iterated with a char pointer to the address
just after the right-bottom corner of the array.  It was in effect a
memset, just hand-written.


More information about the svn-src-head mailing list