From 7ef227b5d705da0d400e1523d2f6dd343948e5c2 Mon Sep 17 00:00:00 2001 From: chris mikkelson Date: Wed, 31 Mar 2010 15:08:30 -0500 Subject: [PATCH] Correctly compute length of commands terminated by bare newlines. --- smtp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/smtp.c b/smtp.c index 406370b..c730052 100644 --- a/smtp.c +++ b/smtp.c @@ -255,7 +255,7 @@ do_smtp(struct conn *c, char **buf, int *len) } else { char *t = strnstr(*buf, "\r\n", *len); char *cmd = *buf; - int clen = t - *buf; + int clen; if (t) { t += 2; @@ -265,7 +265,8 @@ do_smtp(struct conn *c, char **buf, int *len) if (!t) return 0; t ++; } - *len -= t - *buf; + clen = t - *buf; + *len -= clen; *buf = t; return do_command(c, cmd, clen); -- 2.50.1