WORD iDay;
  TCHAR text[3];
   _stprintf_s(text, sizeof(text), _T("%d"), iDay);
The above piece of code giving some out of bound access error by some Static code analyser. The iDay is used for Date: ie: 1 - 31.

What should be the proper check to avoid this instead of using a CString in place or TCHAR. ?