From 36ec2416e44b50c892b3fb2f2e1c81aa9bd01c3c Mon Sep 17 00:00:00 2001 From: Dave Cramer Date: Tue, 27 May 2025 10:34:51 -0400 Subject: [PATCH] fix possible int overflow fixes #Issue 119 --- win_unicode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/win_unicode.c b/win_unicode.c index b2e65bb6..07be16f3 100644 --- a/win_unicode.c +++ b/win_unicode.c @@ -13,6 +13,7 @@ #include #include #include +#include #ifdef WIN32 #define FORMAT_SIZE_T "%Iu" @@ -1278,6 +1279,11 @@ SQLLEN bindcol_localize_exec(char *ldt, size_t n, BOOL lf_conv, char **wcsbuf) { SQLLEN l = (-2); + if (n > INT_MAX) { + // Handle error case + return -1; + } + get_convtype(); MYLOG(0, " size=" FORMAT_SIZE_T "\n", n); #if defined(__WCS_ISO10646__)