From: tobhe Date: Mon, 13 Nov 2023 09:18:19 +0000 (+0000) Subject: Make sure sftp_get_limits() only returns 0 if 'limits' was initialized. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=22a86cc3a1594c2f738d73ecf944b2e5a72a034f;p=openbsd Make sure sftp_get_limits() only returns 0 if 'limits' was initialized. This fixes a potential uninitialized use of 'limits' in sftp_init() if sftp_get_limits() returned early because of an unexpected message type. ok djm@ --- diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c index c30d782d434..f4dc2b011bb 100644 --- a/usr.bin/ssh/sftp-client.c +++ b/usr.bin/ssh/sftp-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.c,v 1.174 2023/09/08 06:10:02 djm Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.175 2023/11/13 09:18:19 tobhe Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -636,7 +636,7 @@ sftp_get_limits(struct sftp_conn *conn, struct sftp_limits *limits) /* Disable the limits extension */ conn->exts &= ~SFTP_EXT_LIMITS; sshbuf_free(msg); - return 0; + return -1; } memset(limits, 0, sizeof(*limits));