The code provided in this message is unsafe because it does not comply with the rule regarding initialization vectors, which are random values. Note that the engineer who wrote it commented:
//... dummy in this case 0's.
True fixed size initialization vectors (or IVs, as the blog calls them) will never allocate a buffer that will be passed crypto functions with the same value again and again, instead they will randomize the data contained in the buffer each time so that its location cannot be deduced if you look at the sample code provided by the author. Just cut out the memset() call, and this block of memory will be filled with garbage at runtime. If you want technical information, write your own version of memset() , which generates pseudo-random data to overwrite the memory of this local one.
source share