Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 3c68198e7 ("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>

authored by

Sasha Levin and committed by
David S. Miller
320f1a4a 18715b26

+1 -1
+1 -1
net/sctp/sysctl.c
··· 320 320 struct ctl_table tbl; 321 321 bool changed = false; 322 322 char *none = "none"; 323 - char tmp[8]; 323 + char tmp[8] = {0}; 324 324 int ret; 325 325 326 326 memset(&tbl, 0, sizeof(struct ctl_table));