[fpc-pascal] Array clearing

wkitty42 at windstream.net wkitty42 at windstream.net
Sat Apr 1 19:42:40 CEST 2017


On 04/01/2017 07:31 AM, Jürgen Hestermann wrote:
> I am wondering what the purpose of filling all
> array elements with zero's could be.
> If I want to discard all elements I would simply delete
> the whole array (setlength(MyArray,0) ).

consider this: when using a string var and writing to a binary file... you reuse 
the string var for each value written... if you don't clear the string var 
between fills then the binary will contain "garbage" in the unused positions of 
the string var... you can see this "garbage" when you view the binary file in 
hex mode... the "garbage" being older longer string data than the current string 
data in the var... this var may be a global throwaway string var...

we've seen the above since back in the TP3 days, at least... in some cases, 
we've been able to extract enough "garbage" to break security on a system... 
especially when there was enough left to suss out the leading part...

-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list* unless
        private contact is specifically requested and granted.



More information about the fpc-pascal mailing list