va_start(ap, fmt);
n = vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
- if (n == -1 || n >= LINE_MAX)
- fatalx("smtp_reply: line too long");
+ if (n < 0)
+ fatalx("smtp_reply: response format error");
if (n < 4)
fatalx("smtp_reply: response too short");
+ if (n >= (int)sizeof buf) {
+ /* only first three bytes are used by SMTP logic,
+ * so if _our_ reply does not fit entirely in the
+ * buffer, it's ok to truncate.
+ */
+ }