summaryrefslogtreecommitdiff
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorOmar Polo <op@cvs.openbsd.org>2023-06-28 17:35:07 +0000
committerOmar Polo <op@cvs.openbsd.org>2023-06-28 17:35:07 +0000
commit908d5114cc223fa707c4a6454757e98487e523b3 (patch)
tree6a9a01c8d46b736aa0755258688efb6e39fdba8d /usr.bin/ftp
parent53c6f3d03e6e6c1a130423beee20a90ac0dbde1e (diff)
drop needless strcspn in the header parsing
since fetch.c revision 1.211, ftp removes trailingwhitespaces early so there's no need to re-do that when parsing a header. while here, remove an unused variable too. ok tb, millert
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/Makefile3
-rw-r--r--usr.bin/ftp/fetch.c7
2 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/ftp/Makefile b/usr.bin/ftp/Makefile
index 38480bfaefb..60dd76144f3 100644
--- a/usr.bin/ftp/Makefile
+++ b/usr.bin/ftp/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.35 2021/02/16 16:27:34 naddy Exp $
+# $OpenBSD: Makefile,v 1.36 2023/06/28 17:35:06 op Exp $
# Define SMALL to disable command line editing and some other features,
# NOSSL to disable https support.
@@ -12,5 +12,6 @@ LDADD+= -ledit -lcurses -ltls -lssl -lcrypto
DPADD+= ${LIBEDIT} ${LIBCURSES} ${LIBTLS} ${LIBSSL} ${LIBCRYPTO}
#COPTS+= -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes
+COPTS+= -Wall -Wstrict-prototypes -Wmissing-prototypes
.include <bsd.prog.mk>
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
index eb4c872b72b..02911b5342a 100644
--- a/usr.bin/ftp/fetch.c
+++ b/usr.bin/ftp/fetch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fetch.c,v 1.215 2023/06/28 11:07:28 op Exp $ */
+/* $OpenBSD: fetch.c,v 1.216 2023/06/28 17:35:06 op Exp $ */
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/*-
@@ -891,7 +891,6 @@ noslash:
if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) {
cp += sizeof(CONTENTLEN) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
filesize = strtonum(cp, 0, LLONG_MAX, &errstr);
if (errstr != NULL)
goto improper;
@@ -964,10 +963,8 @@ noslash:
#define RETRYAFTER "Retry-After:"
} else if (isunavail &&
strncasecmp(cp, RETRYAFTER, sizeof(RETRYAFTER) - 1) == 0) {
- size_t s;
cp += sizeof(RETRYAFTER) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
retryafter = strtonum(cp, 0, 0, &errstr);
if (errstr != NULL)
retryafter = -1;
@@ -976,7 +973,6 @@ noslash:
sizeof(TRANSFER_ENCODING) - 1) == 0) {
cp += sizeof(TRANSFER_ENCODING) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, " \t")] = '\0';
if (strcasecmp(cp, "chunked") == 0)
chunked = 1;
#ifndef SMALL
@@ -985,7 +981,6 @@ noslash:
sizeof(LAST_MODIFIED) - 1) == 0) {
cp += sizeof(LAST_MODIFIED) - 1;
cp += strspn(cp, " \t");
- cp[strcspn(cp, "\t")] = '\0';
if (strptime(cp, "%a, %d %h %Y %T %Z", &lmt) == NULL)
server_timestamps = 0;
#endif /* !SMALL */