You need some buffer overrun protection here.  Otherwise an application developer could dump GB of data into the system logs.