[Lldb-commits] [lldb] r113180 - /lldb/trunk/tools/driver/Driver.cpp

Greg Clayton gclayton at apple.com
Mon Sep 6 16:04:12 PDT 2010


Author: gclayton
Date: Mon Sep  6 18:04:11 2010
New Revision: 113180

URL: http://llvm.org/viewvc/llvm-project?rev=113180&view=rev
Log:
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. 

Modified:
    lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=113180&r1=113179&r2=113180&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Sep  6 18:04:11 2010
@@ -1085,11 +1085,11 @@
     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);
         }
     }





More information about the lldb-commits mailing list