summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2010-06-27 20:00:59 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2010-06-27 20:00:59 +0000
commitca99ab8a1fc9fe04e4f1e10f0019407601ecb9a8 (patch)
tree14715028223a4c85874a500389ff24d7c97b7ff3 /usr.bin
parent2aa866a6af62e49dc2f4f59ebab36f1762bf0f20 (diff)
Fix a crash when the directory entry isn't complete.
found by Alexander Schrijver OK halex@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ftp/list.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/ftp/list.c b/usr.bin/ftp/list.c
index d0d9621875a..adf3643a2bc 100644
--- a/usr.bin/ftp/list.c
+++ b/usr.bin/ftp/list.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: list.c,v 1.3 2009/05/05 19:35:30 martynas Exp $ */
+/* $OpenBSD: list.c,v 1.4 2010/06/27 20:00:58 phessler Exp $ */
/*
* Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
@@ -34,6 +34,8 @@ parse_unix(char **line, char *type)
*type = *tok;
if (field == 7) {
+ if (line == NULL || *line == NULL)
+ break;
while (**line == ' ' || **line == '\t')
(*line)++;
break;
@@ -58,6 +60,8 @@ parse_windows(char **line, char *type)
*type = 'd';
if (field == 2) {
+ if (line == NULL || *line == NULL)
+ break;
while (**line == ' ' || **line == '\t')
(*line)++;
break;