Search code examples
windowsmemory-managementcommand-linepopen

command shell and 128 bytes


This this particular example, why only 128 bytes are being allocated to psBuffer? I tried modifying the command to "dir /s c:\" which gives a lot more than 128 bytes output but program runs just fine without any overflow.

I am curious to know about the significance of 128 bytes in this example.


Solution

  • It's just the size of a buffer, and the code reads up to 128 bytes at a time into this buffer in a loop.