From 10aad1ea2499533e05932ee0438a34bba2b07ed9 Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 17 Jan 2014 00:21:06 +0000 Subject: [PATCH] signed/unsigned comparison warning fix; from portable --- usr.bin/ssh/sftp-client.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c index fc6880d12e0..e69f7fe4188 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.112 2014/01/16 07:31:09 djm Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.113 2014/01/17 00:21:06 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1097,7 +1097,11 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path, local_path, strerror(errno)); goto fail; } - if (st.st_size > size) { + if (st.st_size < 0) { + error("\"%s\" has negative size", local_path); + goto fail; + } + if ((u_int64_t)st.st_size > size) { error("Unable to resume download of \"%s\": " "local file is larger than remote", local_path); fail: -- 2.20.1