Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2492
  • Last Modified:

how to fix buffer overrun

I keep getting the massage saying that " A buffer overrun has been detected which has corrupted  the program's internal state. The program cannot safely continue execution and must now be terminated". How can I fix that problem? I'm not really good with computer so you need to show me every step clearly. Thank you.
0
havannguyen
Asked:
havannguyen
1 Solution
 
itsmeandnobodyelseCommented:
First you must locate the issue in the source code. Easiest would be if the overrun occured in debug mode as well. Then, the debugger would throw an assertion and you could check the call stack to find out where the overrun had occured. It often is a strcpy or memcpy. It also could be a loop writing beyond buffer boundaries.

if it happens in release mode only it is more difficult. You could call a log function (don't forgot to flush each message or open and close the logfile with each call) at begin of each function and at end. After the termination check your logfile and you know in which function the crash happened. Then, narrow the logs until you finally have located the statement. Post it here if you don't know why it crashes.
0
 
BarsMonsterCommented:
You'd better replace all old-school functions like strcpy with safe ones like strcpy_n  which aredesigned specifically to reduce that kind of errors. Also, you may replace all your arrays and dynamic memory with STL data structures. You'd better dig around STL, very nice and productive thing.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now