Fixed a buffer overrun error that could occur every time the program was run due to a "sprintf" with a destination string that was too short.

llvm-svn: 113180
This commit is contained in:
Greg Clayton 2010-09-06 23:04:11 +00:00
parent f7c0fd8dc8
commit b0458249cf
1 changed files with 2 additions and 2 deletions

View File

@ -1085,11 +1085,11 @@ Driver::MainLoop ()
if (isatty (STDIN_FILENO)
&& ::ioctl (STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
{
char buffer[25];
char buffer[256];
if (window_size.ws_col > 0)
{
sprintf (buffer, "settings set term-width %d", window_size.ws_col);
::snprintf (buffer, sizeof(buffer), "settings set term-width %d", window_size.ws_col);
m_debugger.HandleCommand ((const char *) buffer);
}
}