martijnvanbrummelen / nwipe

nwipe secure disk eraser
GNU General Public License v2.0
631 stars 71 forks source link

Fix conditional jump on uninitialised value #571

Closed PartialVolume closed 3 months ago

PartialVolume commented 3 months ago

This fixes a valgrind detected error. We check that the number of real max sectors is greater than zero before incrementing the value by 1. However occasionally the ioctl call may not be able to obtain the dco and therefore the ioctl data block is never populated. By zeroing the data block prior to use and if it is not populated by the ioctl call then the calculated real max sectors will be zero and no increment will occur which is what we want.