[PATCH] Avoiding Segmentation fault while p points to NULL.

krishnaiah bommu krishnaiah.bommu at intel.com
Wed Sep 25 17:55:13 AEST 2019


Signed-off-by: krishnaiah bommu <krishnaiah.bommu at intel.com>
---
 match.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/match.c b/match.c
index fcf6959..ab74211 100644
--- a/match.c
+++ b/match.c
@@ -251,7 +251,8 @@ match_user(const char *user, const char *host, const char *ipaddr,
 
 	pat = xstrdup(pattern);
 	p = strchr(pat, '@');
-	*p++ = '\0';
+	if (p != NULL)
+		*p++ = '\0';
 
 	if ((ret = match_pattern(user, pat)) == 1)
 		ret = match_host_and_ip(host, ipaddr, p);
-- 
2.7.4



More information about the openssh-unix-dev mailing list