title: How to buffer overflow the 'gets' method in Ruby?
body: <p>I wrote a client that gets input from the keyboard and stores it in a variable, like so: </p>
  
  <pre><code>x = gets
  </code></pre>
  
  <p>In C, normally memory is allocated for standard input and thus I can easily overflow the buffer and overwrite the return address on the stack if I write enough characters to the buffer. </p>
  
  <pre><code>char buffer[10];
  gets(buffer);
  </code></pre>
  
  <p>How can I go about overflowing the buffer used in Ruby? I haven't had luck on finding information pertaining to how to exploit programs that are NOT written in C. I've been following a book called "The Shellcoder's Handbook" and everything is in C. Are there any resources I could look at that explain how to exploit programs written in other languages, especially in Ruby? Or is there definitely a reason why most exploit books are written for the C language, as other languages would be too advanced?</p>
  
  <p>Based on observation, it seems as if I can feed as many characters as I want to to the 'gets' method in Ruby and it will not overflow, making it protected from overflow exploits.</p>