diff options
author | Darren Tucker <dtucker@zip.com.au> | 2003-08-26 12:12:56 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2003-08-26 12:12:56 +1000 |
commit | 7858726e8a11574f01a888761b60377530c918d2 (patch) | |
tree | 1976c8aa30a711a3a72d1a4e2ed23e6371963509 /sftp-int.c | |
parent | 600ad8de76e12820ed1ff0db71946b4e03d5349c (diff) |
- fgsch@cvs.openbsd.org 2003/08/25 08:13:09
[sftp-int.c]
fix div by zero when listing for filename lengths longer than width.
markus@ ok.
Diffstat (limited to 'sftp-int.c')
-rw-r--r-- | sftp-int.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sftp-int.c b/sftp-int.c index 73653b7e0..94299aa43 100644 --- a/sftp-int.c +++ b/sftp-int.c | |||
@@ -25,7 +25,7 @@ | |||
25 | /* XXX: recursive operations */ | 25 | /* XXX: recursive operations */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: sftp-int.c,v 1.61 2003/07/19 00:45:53 djm Exp $"); | 28 | RCSID("$OpenBSD: sftp-int.c,v 1.62 2003/08/25 08:13:09 fgsch Exp $"); |
29 | 29 | ||
30 | #include "buffer.h" | 30 | #include "buffer.h" |
31 | #include "xmalloc.h" | 31 | #include "xmalloc.h" |
@@ -600,6 +600,7 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag) | |||
600 | width = ws.ws_col; | 600 | width = ws.ws_col; |
601 | 601 | ||
602 | columns = width / (m + 2); | 602 | columns = width / (m + 2); |
603 | columns = MAX(columns, 1); | ||
603 | colspace = width / columns; | 604 | colspace = width / columns; |
604 | } | 605 | } |
605 | 606 | ||
@@ -686,6 +687,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path, | |||
686 | width = ws.ws_col; | 687 | width = ws.ws_col; |
687 | 688 | ||
688 | columns = width / (m + 2); | 689 | columns = width / (m + 2); |
690 | columns = MAX(columns, 1); | ||
689 | colspace = width / columns; | 691 | colspace = width / columns; |
690 | } | 692 | } |
691 | 693 | ||