1 Star 0 Fork 10

zcj/unixODBC

forked from src-openEuler/unixODBC 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
null_dereference_check.patch 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
diff -rNu unixODBC-2.3.9/DriverManager/SQLGetDiagField.c unixODBC-new/DriverManager/SQLGetDiagField.c
--- unixODBC-2.3.9/DriverManager/SQLGetDiagField.c 2018-10-24 21:31:50.000000000 +0800
+++ unixODBC-new/DriverManager/SQLGetDiagField.c 2021-11-26 11:28:53.723787747 +0800
@@ -701,12 +701,16 @@
{
strcpy( diag_info_ptr, str );
}
- else
+ else if (buffer_length > 0)
{
ret = SQL_SUCCESS_WITH_INFO;
memcpy( diag_info_ptr, str, buffer_length - 1 );
(( char * ) diag_info_ptr )[ buffer_length - 1 ] = '\0';
}
+ else
+ {
+ return SQL_ERROR;
+ }
}
if ( string_length_ptr )
{
diff -rNu unixODBC-2.3.9/DriverManager/SQLGetStmtAttr.c unixODBC-new/DriverManager/SQLGetStmtAttr.c
--- unixODBC-2.3.9/DriverManager/SQLGetStmtAttr.c 2019-05-21 01:46:10.000000000 +0800
+++ unixODBC-new/DriverManager/SQLGetStmtAttr.c 2021-11-26 11:30:02.537064385 +0800
@@ -188,6 +188,10 @@
SQLRETURN ret;
SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ];
+ if (value == NULL) {
+ return SQL_ERROR;
+ }
+
/*
* check statement
*/
diff -rNu unixODBC-2.3.9/DriverManager/SQLGetStmtOption.c unixODBC-new/DriverManager/SQLGetStmtOption.c
--- unixODBC-2.3.9/DriverManager/SQLGetStmtOption.c 2018-10-24 21:34:27.000000000 +0800
+++ unixODBC-new/DriverManager/SQLGetStmtOption.c 2021-11-26 11:30:43.685827785 +0800
@@ -132,6 +132,10 @@
* check statement
*/
+ if (value == NULL) {
+ return SQL_ERROR;
+ }
+
if ( !__validate_stmt( statement ))
{
dm_log_write( __FILE__,
diff -rNu unixODBC-2.3.9/DriverManager/SQLParamOptions.c unixODBC-new/DriverManager/SQLParamOptions.c
--- unixODBC-2.3.9/DriverManager/SQLParamOptions.c 2018-05-30 17:24:07.000000000 +0800
+++ unixODBC-new/DriverManager/SQLParamOptions.c 2021-11-26 11:31:39.094855745 +0800
@@ -141,6 +141,10 @@
* check statement
*/
+ if (statement -> connection -> driver_act_ver != SQL_OV_ODBC2) {
+ return SQL_ERROR;
+ }
+
if ( !__validate_stmt( statement ))
{
dm_log_write( __FILE__,
diff -rNu unixODBC-2.3.9/DriverManager/SQLRowCount.c unixODBC-new/DriverManager/SQLRowCount.c
--- unixODBC-2.3.9/DriverManager/SQLRowCount.c 2018-05-30 17:24:07.000000000 +0800
+++ unixODBC-new/DriverManager/SQLRowCount.c 2021-11-26 11:32:24.967706787 +0800
@@ -139,6 +139,10 @@
SQLRETURN ret;
SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ];
+ if (!rowcount) {
+ return SQL_ERROR;
+ }
+
/*
* check statement
*/
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jcz1234567/unixODBC.git
git@gitee.com:jcz1234567/unixODBC.git
jcz1234567
unixODBC
unixODBC
master

搜索帮助