diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c index f83f4cdfb..515e70f87 100644 --- a/darshan-runtime/lib/darshan-core.c +++ b/darshan-runtime/lib/darshan-core.c @@ -1120,7 +1120,7 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core, static int darshan_should_instrument_app(struct darshan_core_runtime *core) { char *tmp_str; - char *app_name; + char *app_name=NULL; struct darshan_core_regex *app_regex; int app_excluded = 0, app_included = 0; @@ -2064,7 +2064,8 @@ void darshan_log_finalize(char *logfile_name, double start_log_time) if(new_logfile_name) { /* copy partial log file name over to new string */ - strncpy(new_logfile_name, logfile_name, __DARSHAN_PATH_MAX); + strncpy(new_logfile_name, logfile_name, __DARSHAN_PATH_MAX-1); + new_logfile_name[__DARSHAN_PATH_MAX-1] = '\0'; /* retrieve current time stamp */ end_log_time = darshan_core_wtime_absolute(); /* find location of .darshan_partial extension */ diff --git a/darshan-util/darshan-diff.c b/darshan-util/darshan-diff.c index a77b1cea6..7e9d2eea1 100644 --- a/darshan-util/darshan-diff.c +++ b/darshan-util/darshan-diff.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) struct darshan_mod_record_ref *mod_rec1, *mod_rec2; void *mod_buf1, *mod_buf2; struct darshan_base_record *base_rec1, *base_rec2; - char *file_name1, *file_name2; + char *file_name1=NULL, *file_name2=NULL; int i; int ret; diff --git a/darshan-util/darshan-hdf5-logutils.c b/darshan-util/darshan-hdf5-logutils.c index 79af2f924..2367e0958 100644 --- a/darshan-util/darshan-hdf5-logutils.c +++ b/darshan-util/darshan-hdf5-logutils.c @@ -653,7 +653,7 @@ static void darshan_log_agg_hdf5_files(void *rec, void *agg_rec, int init_flag) break; case H5F_F_META_TIME: /* sum */ - agg_hdf5_rec->counters[i] += hdf5_rec->counters[i]; + agg_hdf5_rec->fcounters[i] += hdf5_rec->fcounters[i]; break; default: agg_hdf5_rec->fcounters[i] = -1; diff --git a/darshan-util/darshan-logutils.c b/darshan-util/darshan-logutils.c index 438046339..40ae731bc 100644 --- a/darshan-util/darshan-logutils.c +++ b/darshan-util/darshan-logutils.c @@ -163,7 +163,8 @@ darshan_fd darshan_log_open(const char *name) free(tmp_fd); return(NULL); } - strncpy(tmp_fd->state->logfile_path, name, __DARSHAN_PATH_MAX); + strncpy(tmp_fd->state->logfile_path, name, __DARSHAN_PATH_MAX-1); + tmp_fd->state->logfile_path[__DARSHAN_PATH_MAX-1] = '\0'; /* read the header from the log file to init fd data structures */ ret = darshan_log_get_header(tmp_fd); @@ -229,7 +230,8 @@ darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type } tmp_fd->state->creat_flag = 1; tmp_fd->partial_flag = partial_flag; - strncpy(tmp_fd->state->logfile_path, name, __DARSHAN_PATH_MAX); + strncpy(tmp_fd->state->logfile_path, name, __DARSHAN_PATH_MAX-1); + tmp_fd->state->logfile_path[__DARSHAN_PATH_MAX-1] = '\0'; /* position file pointer to prealloc space for the log file header * NOTE: the header is written at close time, after all internal data