summaryrefslogtreecommitdiff
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authormartijn <martijn@cvs.openbsd.org>2016-01-28 21:31:51 +0000
committermartijn <martijn@cvs.openbsd.org>2016-01-28 21:31:51 +0000
commitf9a3d09fcd3ee8ca12bc1231954f9375f7906c74 (patch)
tree4fb3ed6174a6abed3b60ff3850725ffb50d9057f /usr.bin/ftp
parent7f35e5497224f904db6196be8e0e00b9703c29cd (diff)
Fix a crash when a server sends a non-standard newline ("\n" instead of "\r\n").
Present since ssl support was initially added in OpenBSD 4.0 Found by sthen@ via github downtime OK sthen@
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/fetch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
index eda0146a553..db80d773566 100644
--- a/usr.bin/ftp/fetch.c
+++ b/usr.bin/ftp/fetch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fetch.c,v 1.144 2016/01/08 20:36:01 sthen Exp $ */
+/* $OpenBSD: fetch.c,v 1.145 2016/01/28 21:31:50 martijn Exp $ */
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/*-
@@ -1557,8 +1557,10 @@ again:
errx(1, "SSL read error: %s", tls_error(tls));
buf[i] = c;
- if (c == '\n')
+ if (c == '\n') {
+ buf[i] = '\0';
break;
+ }
}
*lenp = i;
return (buf);