Question: Somebody told me that this piece of code has some serious issues but I have not been able to get my head around such issues. Can you guys please educate me on this?

```
static char BASED_CODE szFilter[] = "HTML Files (*.xls)|*.xls|All Files (*.*)|*.*||";

const char* filter = "HTML Files (*.xlsx)|*.xlsx|All Files (*.*)|*.*||";
size_t length = strlen(filter);
strcpy_s(szFilter, length + 1, filter);

```

Answer: 
The second parameter of [`strcpy_s()`](http://msdn.microsoft.com/en-us/library/td1esda9(v=vs.80).aspx) should be the size of the *destination* buffer; you've given it the size of the input string.

But as you're working in C++, you should avoid `strcpy()` (etc.) entirely, and use `std::string`.
`szFilter` is shorter than `filter`, so there is not enough place to copy `filter` to `szFilter`. You current code has undefined behaviour.