Commit 320f1a4a175e7cd5d3f006f92b4d4d3e2cbb7bb5

Authored by Sasha Levin
Committed by David S. Miller
1 parent 18715b2615

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -320,7 +320,7 @@
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));