From e55a1c8afd6b008fd015b4ce9a59b1044fde8a96 Mon Sep 17 00:00:00 2001 From: chris mikkelson Date: Wed, 31 Mar 2010 23:01:59 -0500 Subject: [PATCH] Correct command length, part 2: compute length not including line terminator. --- smtp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/smtp.c b/smtp.c index c730052..71a4b16 100644 --- a/smtp.c +++ b/smtp.c @@ -258,15 +258,16 @@ do_smtp(struct conn *c, char **buf, int *len) int clen; if (t) { + clen = t - *buf; t += 2; } else { t = memchr((void *)*buf, '\n', *len); if (!t) return 0; - t ++; + clen = t - *buf; + t++; } - clen = t - *buf; - *len -= clen; + *len -= t - *buf; *buf = t; return do_command(c, cmd, clen); -- 2.50.1