Skip to content

Commit 320f1a4

Browse files
sashalevindavem330
authored andcommitted
net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory
proc_dostring() needs an initialized destination string, while the one provided in proc_sctp_do_hmac_alg() contains stack garbage. Thus, writing to cookie_hmac_alg would strlen() that garbage and end up accessing invalid memory. Fixes: 3c68198 ("sctp: Make hmac algorithm selection for cookie generation dynamic") Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 18715b2 commit 320f1a4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/sctp/sysctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
320320
struct ctl_table tbl;
321321
bool changed = false;
322322
char *none = "none";
323-
char tmp[8];
323+
char tmp[8] = {0};
324324
int ret;
325325

326326
memset(&tbl, 0, sizeof(struct ctl_table));

0 commit comments

Comments
 (0)