diff options
author | Avra Sengupta <asengupt@redhat.com> | 2013-08-26 18:14:48 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-09-05 02:33:18 -0700 |
commit | 3b8b184afe5579425e0e4dcb50dd8dd99d33b63a (patch) | |
tree | 00d2456ad259629ab7372fab6b9a0a3316f21554 /xlators/features/gfid-access/src/gfid-access.c | |
parent | 85c2b2de12e98a8cce34277541df8c5c511e7231 (diff) |
gfid-access: Error logs for ga_newfile_parse_args
Change-Id: I7aab98a70793bee936272f0b795f4c22c3733dd2
BUG: 1001055
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/5705
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/features/gfid-access/src/gfid-access.c')
-rw-r--r-- | xlators/features/gfid-access/src/gfid-access.c | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 755add52265..e3882c1d723 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -68,8 +68,12 @@ ga_newfile_parse_args (xlator_t *this, data_t *data) min_len = sizeof (args->uid) + sizeof (args->gid) + sizeof (args->gfid) + sizeof (args->st_mode) + 2 + 2; - if (blob_len < min_len) + if (blob_len < min_len) { + gf_log (this->name, GF_LOG_ERROR, + "Invalid length: Total length is less " + "than minimum length."); goto err; + } args = mem_get0 (priv->newfile_args_pool); if (args == NULL) @@ -93,7 +97,12 @@ ga_newfile_parse_args (xlator_t *this, data_t *data) len = strnlen (blob, blob_len); if (len == blob_len) + if (len == blob_len) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. No null byte present.", + args->gfid); goto err; + } args->bname = GF_CALLOC (1, (len + 1), gf_common_mt_char); if (args->bname == NULL) @@ -104,25 +113,39 @@ ga_newfile_parse_args (xlator_t *this, data_t *data) blob_len -= (len + 1); if (S_ISDIR (args->st_mode)) { - if (blob_len < sizeof (uint32_t)) + if (blob_len < sizeof (uint32_t)) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; + } args->args.mkdir.mode = ntoh32 (*(uint32_t *)blob); blob += sizeof (uint32_t); blob_len -= sizeof (uint32_t); - if (blob_len < sizeof (uint32_t)) + if (blob_len < sizeof (uint32_t)) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; + } args->args.mkdir.umask = ntoh32 (*(uint32_t *)blob); blob += sizeof (uint32_t); blob_len -= sizeof (uint32_t); - if (blob_len < 0) + if (blob_len < 0) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; - + } } else if (S_ISLNK (args->st_mode)) { len = strnlen (blob, blob_len); - if (len == blob_len) + if (len == blob_len) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; - + } args->args.symlink.linkpath = GF_CALLOC (1, len + 1, gf_common_mt_char); if (args->args.symlink.linkpath == NULL) @@ -132,27 +155,43 @@ ga_newfile_parse_args (xlator_t *this, data_t *data) blob += (len + 1); blob_len -= (len + 1); } else { - if (blob_len < sizeof (uint32_t)) + if (blob_len < sizeof (uint32_t)) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; + } args->args.mknod.mode = ntoh32 (*(uint32_t *)blob); blob += sizeof (uint32_t); blob_len -= sizeof (uint32_t); - if (blob_len < sizeof (uint32_t)) + if (blob_len < sizeof (uint32_t)) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; + } args->args.mknod.rdev = ntoh32 (*(uint32_t *)blob); blob += sizeof (uint32_t); blob_len -= sizeof (uint32_t); - if (blob_len < sizeof (uint32_t)) + if (blob_len < sizeof (uint32_t)) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; + } args->args.mknod.umask = ntoh32 (*(uint32_t *)blob); blob += sizeof (uint32_t); blob_len -= sizeof (uint32_t); } - if (blob_len) + if (blob_len) { + gf_log (this->name, GF_LOG_ERROR, + "gfid: %s. Invalid length", + args->gfid); goto err; + } return args; |