summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorSakshi Bansal <sabansal@redhat.com>2015-02-09 14:28:21 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-04-12 09:11:54 -0700
commiteb7cbf37df611fc5288eb75c7d46ef44fe7d6bab (patch)
tree2ab504dafe04388afc8665adc290b66c2dab3ad2 /glusterfsd
parent05bc8bfd2a11d280fe0aaac6c7ae86ea5ff08164 (diff)
glusterfsd: coverity fix
CID 1124846: string overflow CID 1124363: checked return value CID 1210982: unsigned compare Change-Id: I5995d98c07750615657668535fcc23ac30b3523b BUG: 789278 Signed-off-by: Sakshi Bansal <sabansal@redhat.com> Reviewed-on: http://review.gluster.org/9608 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index ad18a4ffda7..3d54229d894 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1169,13 +1169,12 @@ parse_opts (int key, char *arg, struct argp_state *state)
if (gf_string2uint32 (arg, &cmd_args->log_buf_size)) {
argp_failure (state, -1, 0,
"unknown log buf size option %s", arg);
- } else if ((cmd_args->log_buf_size < GF_LOG_LRU_BUFSIZE_MIN) ||
- (cmd_args->log_buf_size > GF_LOG_LRU_BUFSIZE_MAX)) {
- argp_failure (state, -1, 0,
- "Invalid log buf size %s. "
- "Valid range: ["
- GF_LOG_LRU_BUFSIZE_MIN_STR","
- GF_LOG_LRU_BUFSIZE_MAX_STR"]", arg);
+ } else if (cmd_args->log_buf_size > GF_LOG_LRU_BUFSIZE_MAX) {
+ argp_failure (state, -1, 0,
+ "Invalid log buf size %s. "
+ "Valid range: ["
+ GF_LOG_LRU_BUFSIZE_MIN_STR","
+ GF_LOG_LRU_BUFSIZE_MAX_STR"]", arg);
}
break;
@@ -2338,7 +2337,8 @@ main (int argc, char *argv[])
strcpy (cmdlinestr, argv[0]);
for (i = 1; i < argc; i++) {
strcat (cmdlinestr, " ");
- strcat (cmdlinestr, argv[i]);
+ strncat (cmdlinestr, argv[i],
+ (sizeof (cmdlinestr) - 1));
}
gf_msg (argv[0], GF_LOG_INFO, 0, glusterfsd_msg_30,
argv[0], PACKAGE_VERSION, cmdlinestr);