summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-08-25 08:13:10 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-08-25 08:13:10 +0000
commitfd3d20db9e6d61e03b35525933f4e2071899dcda (patch)
tree67ad23523959046c4426d440b83b5ef9d97bf45f /usr.bin
parent7fe8706d488a53b68a88386838c7d4fb886cfb9b (diff)
fix div by zero when listing for filename lengths longer than width.
markus@ ok.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sftp-int.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/sftp-int.c b/usr.bin/ssh/sftp-int.c
index 0971579a4b0..c238c2e09bf 100644
--- a/usr.bin/ssh/sftp-int.c
+++ b/usr.bin/ssh/sftp-int.c
@@ -25,7 +25,7 @@
/* XXX: recursive operations */
#include "includes.h"
-RCSID("$OpenBSD: sftp-int.c,v 1.61 2003/07/19 00:45:53 djm Exp $");
+RCSID("$OpenBSD: sftp-int.c,v 1.62 2003/08/25 08:13:09 fgsch Exp $");
#include <glob.h>
@@ -602,6 +602,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
width = ws.ws_col;
columns = width / (m + 2);
+ columns = MAX(columns, 1);
colspace = width / columns;
}
@@ -688,6 +689,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
width = ws.ws_col;
columns = width / (m + 2);
+ columns = MAX(columns, 1);
colspace = width / columns;
}