Fix BDAT issue for body w/o trailing CRLF (again Bug 1974)
[exim.git] / src / src / smtp_in.c
index 9efe7baa9a9b357aa0937354c9d0b3df0a8f5145..8e9b93ab39becb029e42667b79dd346ded61539e 100644 (file)
@@ -831,6 +831,9 @@ Returns:       the character
 int
 smtp_ungetc(int ch)
 {
+if (smtp_inptr <= smtp_inbuffer)
+  log_write(0, LOG_MAIN|LOG_PANIC_DIE, "buffer underflow in smtp_ungetc");
+
 *--smtp_inptr = ch;
 return ch;
 }
@@ -840,6 +843,7 @@ int
 bdat_ungetc(int ch)
 {
 chunking_data_left++;
+bdat_push_receive_functions();  /* we're not done yet, calling push is safe, because it checks the state before pushing anything */
 return lwr_receive_ungetc(ch);
 }