From 22cda9924c239bb8e30cba5908182f67c4c84e39 Mon Sep 17 00:00:00 2001 From: djm Date: Thu, 6 Apr 2023 03:19:32 +0000 Subject: [PATCH] match_user() shouldn't be called with user==NULL unless host and ipaddr are also NULL --- usr.bin/ssh/match.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/ssh/match.c b/usr.bin/ssh/match.c index a49c04e322c..58888655f60 100644 --- a/usr.bin/ssh/match.c +++ b/usr.bin/ssh/match.c @@ -1,4 +1,4 @@ -/* $OpenBSD: match.c,v 1.43 2020/11/03 22:53:12 djm Exp $ */ +/* $OpenBSD: match.c,v 1.44 2023/04/06 03:19:32 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -240,6 +240,9 @@ match_user(const char *user, const char *host, const char *ipaddr, return 0; } + if (user == NULL) + return 0; /* shouldn't happen */ + if ((p = strchr(pattern, '@')) == NULL) return match_pattern(user, pattern); -- 2.20.1