Skip to content
Snippets Groups Projects
Commit 1e14af95 authored by Andreas Dilger's avatar Andreas Dilger
Browse files

Branch HEAD

Limit snprintf/strncpy modification of debug_file_name to
sizeof(debug_file_name) instead of sizeof(debug_file_path).

Both are currently the same size, but may change at some point in the future.
parent 280746c3
No related branches found
No related tags found
No related merge requests found
...@@ -406,7 +406,7 @@ void libcfs_debug_dumplog_internal(void *arg) ...@@ -406,7 +406,7 @@ void libcfs_debug_dumplog_internal(void *arg)
CFS_PUSH_JOURNAL; CFS_PUSH_JOURNAL;
if (strncmp(debug_file_path, "NONE", 4) != 0) { if (strncmp(debug_file_path, "NONE", 4) != 0) {
snprintf(debug_file_name, sizeof(debug_file_path) - 1, snprintf(debug_file_name, sizeof(debug_file_name) - 1,
"%s.%ld.%ld", debug_file_path, cfs_time_current_sec(), "%s.%ld.%ld", debug_file_path, cfs_time_current_sec(),
(long)arg); (long)arg);
printk(KERN_ALERT "LustreError: dumping log to %s\n", printk(KERN_ALERT "LustreError: dumping log to %s\n",
...@@ -653,7 +653,7 @@ int libcfs_debug_init(unsigned long bufsize) ...@@ -653,7 +653,7 @@ int libcfs_debug_init(unsigned long bufsize)
debug_filename = getenv("LIBLUSTRE_DEBUG_FILE"); debug_filename = getenv("LIBLUSTRE_DEBUG_FILE");
if (debug_filename) if (debug_filename)
strncpy(debug_file_name,debug_filename,sizeof(debug_file_path)); strncpy(debug_file_name,debug_filename,sizeof(debug_file_name));
if (debug_file_name[0] == '\0' && debug_file_path[0] != '\0') if (debug_file_name[0] == '\0' && debug_file_path[0] != '\0')
snprintf(debug_file_name, sizeof(debug_file_name) - 1, snprintf(debug_file_name, sizeof(debug_file_name) - 1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment