diff options
author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2014-08-27 10:35:33 +0500 |
---|---|---|
committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2014-08-27 10:35:33 +0500 |
commit | bf0ea9ea9efb05be1e6cbb23574b001fd0372b79 (patch) | |
tree | b10a6ecb37cb79a724bd3023a5c30642719f8475 | |
parent | 3d1c9e91db3ff5929436ef93e0e5a5ed45687e79 (diff) |
Bounds check array index. Fixes a crash when len == 1.
-rw-r--r-- | session.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -708,7 +708,7 @@ session_write(struct session *s, const char *data, size_t len) if (data[len - 1] == '\n') len -= 1; - if (data[len - 1] == '\r') + if (len && data[len - 1] == '\r') len -= 1; /* byte stuff "." if at beginning of line */ |