From 65d64a5b60a4a3883f2cd799d92c6091d8854f23 Mon Sep 17 00:00:00 2001 From: JerikoOne Date: Sat, 7 Jul 2018 16:20:56 -0500 Subject: [PATCH] Check for int underflow in imap_quote_string --- imap/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imap/util.c b/imap/util.c index 58224fc38..57802b254 100644 --- a/imap/util.c +++ b/imap/util.c @@ -821,9 +821,9 @@ void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_back { if (strchr(quote, *s)) { - dlen -= 2; - if (dlen == 0) + if (dlen < 2) break; + dlen -= 2; *pt++ = '\\'; *pt++ = *s; } -- 2.49.0