In "The Security Development Lifecycle" book, Michael Howard wrote:
Take as an example the coding bug in Windows RPC/DCOM that the Blaster worm took advantage of (Microsoft 2003). The defective code looks like this:
HRESULT GetMachineName(WCHAR *pwszPath, WCHAR wszMachineName[N + 1]) { LPWSTR pwszServerName = wszMachineName; while (*pwszPath != L'\\' ) *pwszServerName++ = *pwszPath++; ... }In this code, the attacker controls the pwszPath argument so that she can overflow the wszMachineName buffer. This code bug was not picked up by any tools available within Microsoft...
I implemented many codes like the above example previously but I can't find any wrong with it and after testing the above code I still can't find a way to Overflow wszMachineName but as he mentioned this code is vulnerable to buffer overflow.
So my question is: How can an attacker take advantage of above code, like the blaster worm did?! I passed a large number of 'AAAA's to program but, but it continues without crash or problem.