Fixed the potential error reported by Prefast code analysis
This commit is contained in:
parent
4509756066
commit
10ff344fca
|
@ -1276,7 +1276,7 @@ char * pdo_sqlsrv_dbh_last_id( _Inout_ pdo_dbh_t *dbh, _In_z_ const char *name,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
char last_insert_id_query[ LAST_INSERT_ID_QUERY_MAX_LEN ];
|
char last_insert_id_query[ LAST_INSERT_ID_QUERY_MAX_LEN ] = {'\0'};
|
||||||
if( name == NULL ) {
|
if( name == NULL ) {
|
||||||
strcpy_s( last_insert_id_query, sizeof( last_insert_id_query ), LAST_INSERT_ID_QUERY );
|
strcpy_s( last_insert_id_query, sizeof( last_insert_id_query ), LAST_INSERT_ID_QUERY );
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1300,7 @@ char * pdo_sqlsrv_dbh_last_id( _Inout_ pdo_dbh_t *dbh, _In_z_ const char *name,
|
||||||
|
|
||||||
sqlsrv_malloc_auto_ptr<SQLWCHAR> wsql_string;
|
sqlsrv_malloc_auto_ptr<SQLWCHAR> wsql_string;
|
||||||
unsigned int wsql_len;
|
unsigned int wsql_len;
|
||||||
wsql_string = utf16_string_from_mbcs_string( SQLSRV_ENCODING_CHAR, reinterpret_cast<const char*>( last_insert_id_query ), static_cast<unsigned int>( strnlen_s( last_insert_id_query )), &wsql_len );
|
wsql_string = utf16_string_from_mbcs_string( SQLSRV_ENCODING_CHAR, reinterpret_cast<const char*>( last_insert_id_query ), sizeof(last_insert_id_query), &wsql_len );
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( wsql_string == 0, driver_stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message() ) {
|
CHECK_CUSTOM_ERROR( wsql_string == 0, driver_stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message() ) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
|
|
Loading…
Reference in a new issue