CVE-2020-28024: Heap buffer underflow in smtp_ungetc()
[exim.git] / src / src / smtp_in.c
index 9efe7baa9a9b357aa0937354c9d0b3df0a8f5145..647c231c71983dde63b2093bad5d2dbd136a4a24 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;
 }