dabelknap / VMEStream

0 stars 1 forks source link

Fix memory corruption on \n #1

Closed ekfriis closed 11 years ago

ekfriis commented 11 years ago

Hi Austin,

The reason you see memory corruption is that you can't rely that data you read is a "C-style string", i.e. a null-terminated char* string. So strlen(buffer) might discover a too-long string because it just goes until it finds a null char. The solution is to only write the number of bytes which are read - this number is given to you by read.

Evan

dabelknap commented 11 years ago

Cool, thanks!