title: Buffer Overflow Protective mechanisms in Python
body: <p>I have been slightly confused by the way a common python function available  called raw_input operates.</p>
  
  <p>I don't appear to have any restrictions to <a href="https://stackoverflow.com/questions/8469122/maximum-characters-that-can-be-stuffed-into-raw-input-in-python">input however many chars I want here</a> . The function help also does not appear to ask for a maximum number of characters as an argument as shown below (it only allows user to enter a prompt message). </p>
  
  <pre><code>raw_input(...)
      raw_input([prompt]) -&gt; string
  
      Read a string from standard input.  The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.On Unix, GNU readline is used if enabled.  The prompt string, if given, is printed without a trailing newline before reading.
  </code></pre>
  
  <p>How does Python stop a buffer overflow attack or any attempt to consume excessive memory in a scenario where data is read in from user as a string - which is basically an array of chars - as shown below???</p>
  
  <pre><code>&gt;&gt; r=raw_input("enter something:")
  enter something: dfjdfldfkdflkjdflkdjflkjfdlfdjklfdkjfdlkjfdlkfjdlkdfjlfdj..... 
  &gt;&gt; print r
  dfjdfldfkdflkjdflkdjflkjfdlfdjklfdkjfdlkjfdlkfjdlkdfjlfdj.....
  </code></pre>
  
  <p>Thanks and Kind Regards, </p>
  
  <p>John</p>