From: chris mikkelson Date: Wed, 31 Mar 2010 20:08:30 +0000 (-0500) Subject: Correctly compute length of commands terminated by bare newlines. X-Git-Url: https://git.mikk.net/?a=commitdiff_plain;h=7ef227b5d705da0d400e1523d2f6dd343948e5c2;p=smtpsink Correctly compute length of commands terminated by bare newlines. --- 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);