Fix use-after-free error (#1409433)

This commit is contained in:
Jakub Jelen 2017-01-02 14:23:54 +01:00
parent 38869a3406
commit dd8e5419eb

View File

@ -288,7 +288,7 @@ diff -up openssh/monitor.c.role-mls openssh/monitor.c
if (buffer_get_char(&b) != SSH2_MSG_USERAUTH_REQUEST) if (buffer_get_char(&b) != SSH2_MSG_USERAUTH_REQUEST)
fail++; fail++;
cp = buffer_get_cstring(&b, NULL); cp = buffer_get_cstring(&b, NULL);
+ if ((r = strchr(p, '/')) != NULL) + if ((r = strchr(cp, '/')) != NULL)
+ *r = '\0'; + *r = '\0';
xasprintf(&userstyle, "%s%s%s", authctxt->user, xasprintf(&userstyle, "%s%s%s", authctxt->user,
authctxt->style ? ":" : "", authctxt->style ? ":" : "",