A Lustre filesystem name is up to 8 characters, plus 1 for the NUL
terminator. If a filesystem name is 8 characters, then the
llapi_layout_test, llapi_hsm_test, group_lock_test and llapi_fid_test
may have their stack scribbled or overran when they call
llapi_search_mounts(). Add one extra byte for the NUL character.
Same issue with a FID string, which also needs an extra character for
NUL termination.
Signed-off-by: frank zago <fzago@cray.com>
Change-Id: Ic7757ebce051e12f4723e27b5b00d4db1637b384
Reviewed-on: http://review.whamcloud.com/14213
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
- len = snprintf(name, FID_LEN + 1, DFID":", PFID(&ent->lde_fid));
+ len = snprintf(name, sizeof(name),
+ DFID":", PFID(&ent->lde_fid));
/* The ent->lde_name is composed of ${FID}:${index} */
if (ent->lde_namelen < len + 1 ||
memcmp(ent->lde_name, name, len) != 0) {
/* The ent->lde_name is composed of ${FID}:${index} */
if (ent->lde_namelen < len + 1 ||
memcmp(ent->lde_name, name, len) != 0) {
lustre_fid fid;
lustre_fid fid2;
lustre_fid fid3;
lustre_fid fid;
lustre_fid fid2;
lustre_fid fid3;
+ char fidstr[FID_LEN + 1];
char path1[PATH_MAX];
char path2[PATH_MAX];
char path3[PATH_MAX];
char path1[PATH_MAX];
char path2[PATH_MAX];
char path3[PATH_MAX];
int rc;
int fd;
lustre_fid fid;
int rc;
int fd;
lustre_fid fid;
+ char fidstr[FID_LEN + 1];
char path[PATH_MAX];
long long recno;
int linkno;
char path[PATH_MAX];
long long recno;
int linkno;
char buf[PATH_MAX];
char buf2[PATH_MAX];
lustre_fid fid;
char buf[PATH_MAX];
char buf2[PATH_MAX];
lustre_fid fid;
+ char fidstr[FID_LEN + 1];
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
int rc;
process_args(argc, argv);
int rc;
process_args(argc, argv);
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
int rc;
process_args(argc, argv);
int rc;
process_args(argc, argv);
int rc = 0;
int i;
struct stat s;
int rc = 0;
int i;
struct stat s;
llapi_msg_set_level(LLAPI_MSG_OFF);
llapi_msg_set_level(LLAPI_MSG_OFF);