summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp/fetch.c
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2016-01-28 21:31:50 +0000
committermartijn <martijn@openbsd.org>2016-01-28 21:31:50 +0000
commitd651329d1550fa357ed63fa29c4b41030404f6ab (patch)
treed12ff0b55acba009fe585f972fa5c29344bc5a1b /usr.bin/ftp/fetch.c
parentHand rolled lists suck. First, replace disk_order with an LIST. (diff)
downloadwireguard-openbsd-d651329d1550fa357ed63fa29c4b41030404f6ab.tar.xz
wireguard-openbsd-d651329d1550fa357ed63fa29c4b41030404f6ab.zip
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 '')
-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);