Skip to content

Commit 65d64a5

Browse files
jeriko-oneflatcap
authored andcommitted
Check for int underflow in imap_quote_string
1 parent 3c49c44 commit 65d64a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: imap/util.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -821,9 +821,9 @@ void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_back
821821
{
822822
if (strchr(quote, *s))
823823
{
824-
dlen -= 2;
825-
if (dlen == 0)
824+
if (dlen < 2)
826825
break;
826+
dlen -= 2;
827827
*pt++ = '\\';
828828
*pt++ = *s;
829829
}

0 commit comments

Comments
 (0)