diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-08-28 15:23:21 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-08-28 15:23:21 +0300 |
commit | 5f35e103ee667b8596efbd138819af8dedd93ed5 (patch) | |
tree | c01e53829e93076958e2c5f625b5bc34f33c12b3 /storage | |
parent | 9cd6e7ad73554be6d0186a42f983777a90a984f1 (diff) | |
parent | 4ba20e0a14b9134a7e71aa4b592522967456317c (diff) | |
download | mariadb-git-5f35e103ee667b8596efbd138819af8dedd93ed5.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/ha_connect.cc | 2 | ||||
-rw-r--r-- | storage/perfschema/pfs_instr.cc | 5 | ||||
-rw-r--r-- | storage/sphinx/ha_sphinx.cc | 9 |
3 files changed, 9 insertions, 7 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 1b3e59214a0..2445abe354f 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -1317,7 +1317,7 @@ char *ha_connect::GetRealString(PCSZ s) { char *sv; - if (IsPartitioned() && s && partname && *partname) { + if (IsPartitioned() && s && *partname) { sv= (char*)PlugSubAlloc(xp->g, NULL, 0); sprintf(sv, s, partname); PlugSubAlloc(xp->g, NULL, strlen(sv) + 1); diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 28e9dfa9fc2..d52af3e80df 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -1265,7 +1265,6 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, char dirbuffer[FN_REFLEN]; size_t dirlen; const char *normalized_filename; - int normalized_length; dirlen= dirname_length(safe_filename); if (dirlen == 0) @@ -1296,7 +1295,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, *buf_end= '\0'; normalized_filename= buffer; - normalized_length= strlen(normalized_filename); + size_t normalized_length= strlen(normalized_filename); PFS_file **entry; uint retry_count= 0; @@ -1345,7 +1344,7 @@ search: pfs->m_class= klass; pfs->m_enabled= klass->m_enabled && flag_global_instrumentation; pfs->m_timed= klass->m_timed; - strncpy(pfs->m_filename, normalized_filename, normalized_length); + strncpy(pfs->m_filename, normalized_filename, normalized_length + 1); pfs->m_filename[normalized_length]= '\0'; pfs->m_filename_length= normalized_length; pfs->m_file_stat.m_open_count= 1; diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 2cf93533a4f..65ad286f5d9 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -2291,7 +2291,8 @@ int ha_sphinx::HandleMysqlError ( MYSQL * pConn, int iErrCode ) CSphSEThreadTable * pTable = GetTls (); if ( pTable ) { - strncpy ( pTable->m_tStats.m_sLastMessage, mysql_error ( pConn ), sizeof ( pTable->m_tStats.m_sLastMessage ) ); + strncpy ( pTable->m_tStats.m_sLastMessage, mysql_error ( pConn ), sizeof pTable->m_tStats.m_sLastMessage - 1 ); + pTable->m_tStats.m_sLastMessage[sizeof pTable->m_tStats.m_sLastMessage - 1] = '\0'; pTable->m_tStats.m_bLastError = true; } @@ -2558,7 +2559,8 @@ bool ha_sphinx::UnpackSchema () CSphSEThreadTable * pTable = GetTls (); if ( pTable ) { - strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof(pTable->m_tStats.m_sLastMessage) ); + strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof pTable->m_tStats.m_sLastMessage - 1 ); + pTable->m_tStats.m_sLastMessage[sizeof pTable->m_tStats.m_sLastMessage - 1] = '\0'; pTable->m_tStats.m_bLastError = ( uStatus==SEARCHD_ERROR ); } @@ -2982,7 +2984,8 @@ int ha_sphinx::index_read ( byte * buf, const byte * key, uint key_len, enum ha_ SPH_RET ( HA_ERR_END_OF_FILE ); } - strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof(pTable->m_tStats.m_sLastMessage) ); + strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof pTable->m_tStats.m_sLastMessage - 1 ); + pTable->m_tStats.m_sLastMessage[sizeof pTable->m_tStats.m_sLastMessage - 1] = '\0'; SafeDeleteArray ( sMessage ); if ( uRespStatus!=SEARCHD_WARNING ) |