summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2010-03-07 10:41:51 -0700
committerMarc Alff <marc.alff@oracle.com>2010-03-07 10:41:51 -0700
commit8c28d0d1cfa5cb4295f9160cdf8e75fc7aac13ef (patch)
tree280ee80ca70a5eed79ecfe0cb919f71babd5f552 /storage/perfschema
parent18884b02c08be7cf45fda7a686943c5a85dedf6f (diff)
parent72ffdcb2a51122400614b78c28fe1567a6f68792 (diff)
downloadmariadb-git-8c28d0d1cfa5cb4295f9160cdf8e75fc7aac13ef.tar.gz
local merge
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/pfs_instr.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 28b54cc6979..fbaac621dfb 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -746,6 +746,26 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
}
}
+ char safe_buffer[FN_REFLEN];
+ const char *safe_filename;
+
+ if (len >= FN_REFLEN)
+ {
+ /*
+ The instrumented code uses file names that exceeds FN_REFLEN.
+ This could be legal for instrumentation on non mysys APIs,
+ so we support it.
+ Truncate the file name so that:
+ - it fits into pfs->m_filename
+ - it is safe to use mysys apis to normalize the file name.
+ */
+ memcpy(safe_buffer, filename, FN_REFLEN - 2);
+ safe_buffer[FN_REFLEN - 1]= 0;
+ safe_filename= safe_buffer;
+ }
+ else
+ safe_filename= filename;
+
/*
Normalize the file name to avoid duplicates when using aliases:
- absolute or relative paths
@@ -759,7 +779,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
Ignore errors, the file may not exist.
my_realpath always provide a best effort result in buffer.
*/
- (void) my_realpath(buffer, filename, MYF(0));
+ (void) my_realpath(buffer, safe_filename, MYF(0));
normalized_filename= buffer;
normalized_length= strlen(normalized_filename);