Use the /robust Flag
Always compile .idl files using the /robust switch. Using the /robust switch generates additional information that enables the Network Data Representation (NDR) engine to perform run-time error checking on correlated arguments in dynamic arrays, unions, and in out interface pointers in COM and RPC applications. If software fails to compile with this flag, the software is so exposed to attacks that no efforts in any other area can protect it.