CVE-2020-28024: Heap buffer underflow in smtp_ungetc()
[exim.git] / src / src / tls.c
index e5aabc6b4b65823b40b9664c119b14784fcd0cd6..d37a8f9ff3ca8362cc8a089c5b796338d64210bd 100644 (file)
@@ -157,6 +157,9 @@ Returns:       the character
 int
 tls_ungetc(int ch)
 {
+if (ssl_xfer_buffer_lwm <= 0)
+  log_write(0, LOG_MAIN|LOG_PANIC_DIE, "buffer underflow in tls_ungetc");
+
 ssl_xfer_buffer[--ssl_xfer_buffer_lwm] = ch;
 return ch;
 }