From 4ea56076a8cb13946de8180a4d185ed928872387 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 16 Jun 2020 17:43:55 +0100 Subject: [PATCH] Add missing cast in RTF paste data construction. udata[uindex] is a wchar_t, so if we pass it to sprintf("%d") we should cast it to int (because who knows what primitive integer type that might have corresponded to otherwise). I had done this in the first of the two sprintfs that use it, but missed the second one a few lines further on. Spotted by Coverity. --- windows/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/window.c b/windows/window.c index f32c9665..ca8757df 100644 --- a/windows/window.c +++ b/windows/window.c @@ -5255,7 +5255,7 @@ static void wintw_clip_write( (int)udata[uindex]); alen = 1; strcpy(after, "}"); } else { - blen = sprintf(before, "\\u%d", udata[uindex]); + blen = sprintf(before, "\\u%d", (int)udata[uindex]); alen = 0; after[0] = '\0'; } }