Module Name: src
Committed By: lukem
Date: Fri Nov 29 04:31:57 UTC 2024
Modified Files:
src/usr.bin/ftp: fetch.c version.h
Log Message:
ftp: exit non-zero if short http transfer when filesize is known
If a http file size is known and the fetch finishes with less bytes
transferred, exit non-zero.
Bump version to 20241129.
PR bin/54713
PR bin/58281
To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/ftp/fetch.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/ftp/version.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.241 src/usr.bin/ftp/fetch.c:1.242
--- src/usr.bin/ftp/fetch.c:1.241 Wed Sep 25 16:55:39 2024
+++ src/usr.bin/ftp/fetch.c Fri Nov 29 04:31:57 2024
@@ -1,7 +1,7 @@
-/* $NetBSD: fetch.c,v 1.241 2024/09/25 16:55:39 christos Exp $ */
+/* $NetBSD: fetch.c,v 1.242 2024/11/29 04:31:57 lukem Exp $ */
/*-
- * Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2024 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.241 2024/09/25 16:55:39 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.242 2024/11/29 04:31:57 lukem Exp $");
#endif /* not lint */
/*
@@ -1861,6 +1861,11 @@ chunkerror:
}
if (bytes > 0)
ptransfer(0);
+
+ /* fail if short transfer when filesize is known */
+ if (filesize >= 0 && (bytes + restart_point < filesize))
+ goto cleanup_fetch_url;
+
bytes = 0;
rval = 0;
Index: src/usr.bin/ftp/version.h
diff -u src/usr.bin/ftp/version.h:1.98 src/usr.bin/ftp/version.h:1.99
--- src/usr.bin/ftp/version.h:1.98 Tue May 16 22:00:23 2023
+++ src/usr.bin/ftp/version.h Fri Nov 29 04:31:57 2024
@@ -1,7 +1,7 @@
-/* $NetBSD: version.h,v 1.98 2023/05/16 22:00:23 lukem Exp $ */
+/* $NetBSD: version.h,v 1.99 2024/11/29 04:31:57 lukem Exp $ */
/*-
- * Copyright (c) 1999-2023 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999-2024 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -34,5 +34,5 @@
#endif
#ifndef FTP_VERSION
-#define FTP_VERSION "20230516"
+#define FTP_VERSION "20241129"
#endif