libpmc: jevents: Go ahead and use snprintf(3)
Reported by: Coverity CID: 1391362
This commit is contained in:
parent
4ff85ece0e
commit
f824ea0c26
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357243
@ -921,7 +921,8 @@ is_leaf_dir(const char *fpath)
|
||||
char path[PATH_MAX];
|
||||
struct stat st;
|
||||
|
||||
sprintf(path, "%s/%s", fpath, dir->d_name);
|
||||
snprintf(path, sizeof(path), "%s/%s", fpath,
|
||||
dir->d_name);
|
||||
if (stat(path, &st))
|
||||
break;
|
||||
|
||||
@ -1080,10 +1081,6 @@ process_one_file(const char *fpath, const struct stat *sb, int typeflag,
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Starting in directory 'start_dirname', find the "mapfile.csv" and
|
||||
* the set of JSON files for the architecture 'arch'.
|
||||
@ -1128,7 +1125,7 @@ main(int argc, char *argv[])
|
||||
return 2;
|
||||
}
|
||||
|
||||
sprintf(ldirname, "%s/%s", start_dirname, arch);
|
||||
snprintf(ldirname, sizeof(ldirname), "%s/%s", start_dirname, arch);
|
||||
|
||||
/* If architecture does not have any event lists, bail out */
|
||||
if (stat(ldirname, &stbuf) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user