From 7258cd8ea42bbff0e6b9a30591dcd5d6c0d69d23 Mon Sep 17 00:00:00 2001 From: Ondrej Dubaj Date: Mon, 10 Feb 2020 10:06:45 +0100 Subject: [PATCH] fixed possible buffer overflow (#1571528) --- DriverManager/__info.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DriverManager/__info.c b/DriverManager/__info.c index 82dad1d..91e8533 100644 --- a/DriverManager/__info.c +++ b/DriverManager/__info.c @@ -761,7 +761,10 @@ char *unicode_to_ansi_copy( char * dest, int dest_len, SQLWCHAR *src, SQLINTEGER *clen = i; } - dest[ i ] = '\0'; + if (dest_len) + { + dest[ i < dest_len ? i : i-1 ] = '\0'; + } return dest; } -- 2.19.1