summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--session.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/session.c b/session.c
index 025105e..da90c78 100644
--- a/session.c
+++ b/session.c
@@ -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 */