Fix possible out of bounds access during log parsing
Fix possible out of bounds access during log parsing

The OCI runtime `parseLog()` function is currently called by
`ExecSyncContainer()` and the RPC entry point `ExecSync()`.

A temporarily log file within `/tmp/crio-log-$CONTAINERID` is created
during the execution of `ExecSync()`, which receives the stdout and
stderr output from the provided command.

This commit fixes an index out-of-bounds runtime panic if the log file
contains an malicious partial (P) log entry which does not contain a newline
at the end of the file, like `2019-03-28T10:24:43.981274081+01:00 stdout P `.

The issue can be reproduced like this:

1. Force creating the logfile in `/tmp` via:
   ```
   > sudo crictl exec -s $CONTAINERID sh -c "echo test && sleep 30"
   ```
2. Modify the logfile with malicious content:
   ```
   > echo -n "2019-03-28T10:24:43.981274081+01:00 stdout P " >> /tmp/crio-log-$CONTAINERID
   ```
3. Wait for the crash

Signed-off-by: Sascha Grunert <70ab469ddb2ac3e35f32ed7c2fd1cca514b2e879@suse.com>

nalind/cri-o,mikebrow/cri-o,mikebrow/cri-o,kubernetes-incubator/ocid,rhatdan/cri-o,nalind/cri-o,kubernetes-incubator/cri-o,nalind/cri-o,mikebrow/cri-o,kubernetes-incubator/cri-o,kubernetes-incubator/ocid,kubernetes-incubator/ocid,mikebrow/cri-o,rhatdan/cri-o,kubernetes-incubator/cri-o,kubernetes-incubator/cri-o,rhatdan/cri-o,rhatdan/cri-o