From dd6c67cf1ed69067b6adb045e14903f805beaf26 Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Tue, 16 Apr 2019 12:52:09 +0200
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 4201185..3620ccb 100644
--- a/DriverManager/__info.c
+++ b/DriverManager/__info.c
@@ -728,7 +728,10 @@ char *unicode_to_ansi_copy( char * dest, int dest_len, SQLWCHAR *src, SQLINTEGER
#endif
}
- dest[ i ] = '\0';
+ if (dest_len)
+ {
+ dest[ i < dest_len ? i : i-1 ] = '\0';
+ }
return dest;
}
--
2.17.1