Browse Source

Bugfix: fpgautils: Initialize my_dev_t instances with null bytes, to ensure random unused data cannot influence hash keys

Luke Dashjr 12 years ago
parent
commit
7c6506053a
1 changed files with 2 additions and 0 deletions
  1. 2 0
      fpgautils.c

+ 2 - 0
fpgautils.c

@@ -459,6 +459,7 @@ struct device_drv *bfg_claim_serial(struct device_drv * const api, const bool ve
 {
 	my_dev_t dev;
 	
+	memset(&dev, 0, sizeof(dev));
 	dev.bus = BDB_SERIAL;
 #ifndef WIN32
 	{
@@ -489,6 +490,7 @@ struct device_drv *bfg_claim_usb(struct device_drv * const api, const bool verbo
 	// We should be able to just initialize a const my_dev_t for this, but Xcode's clang is broken
 	// Affected: Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) AKA Xcode 4.6.3
 	// Works with const: GCC 4.6.3, LLVM 3.1
+	memset(&dev, 0, sizeof(dev));
 	dev.bus = BDB_USB;
 	dev.usbbus = usbbus;
 	dev.usbaddr = usbaddr;