Skip to content

Commit 1be2956

Browse files
Dan CarpenterNicholas Bellinger
authored andcommitted
iscsi-target: make some temporary buffers larger
My static checker complains because we use sprintf() to print some unsigned ints into 10 byte buffers. In theory unsigned ints can take 10 characters and we need another for the terminator. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 1810053 commit 1be2956

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/target/iscsi/iscsi_target_parameters.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,11 +1095,11 @@ static int iscsi_check_acceptor_state(struct iscsi_param *param, char *value,
10951095
SET_PSTATE_REPLY_OPTIONAL(param);
10961096
}
10971097
} else if (IS_TYPE_NUMBER(param)) {
1098-
char *tmpptr, buf[10];
1098+
char *tmpptr, buf[11];
10991099
u32 acceptor_value = simple_strtoul(param->value, &tmpptr, 0);
11001100
u32 proposer_value = simple_strtoul(value, &tmpptr, 0);
11011101

1102-
memset(buf, 0, 10);
1102+
memset(buf, 0, sizeof(buf));
11031103

11041104
if (!strcmp(param->name, MAXCONNECTIONS) ||
11051105
!strcmp(param->name, MAXBURSTLENGTH) ||
@@ -1503,8 +1503,8 @@ static int iscsi_enforce_integrity_rules(
15031503
FirstBurstLength = simple_strtoul(param->value,
15041504
&tmpptr, 0);
15051505
if (FirstBurstLength > MaxBurstLength) {
1506-
char tmpbuf[10];
1507-
memset(tmpbuf, 0, 10);
1506+
char tmpbuf[11];
1507+
memset(tmpbuf, 0, sizeof(tmpbuf));
15081508
sprintf(tmpbuf, "%u", MaxBurstLength);
15091509
if (iscsi_update_param_value(param, tmpbuf))
15101510
return -1;

0 commit comments

Comments
 (0)