summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/auth2-none.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-05-11 19:01:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-05-11 19:01:44 +0000
commit864be3f922476a5c2cc5e3ec42c6881063ce787f (patch)
treed5f2fcc19905bc234c22d2a7e59c30969afd184c /usr.bin/ssh/auth2-none.c
parente58c86ca6a450ac471b70aba4aadaa52d0b1aaa3 (diff)
improve some code lint did not like; djm millert ok
Diffstat (limited to 'usr.bin/ssh/auth2-none.c')
-rw-r--r--usr.bin/ssh/auth2-none.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/ssh/auth2-none.c b/usr.bin/ssh/auth2-none.c
index 58df8d33b09..2a4680578cb 100644
--- a/usr.bin/ssh/auth2-none.c
+++ b/usr.bin/ssh/auth2-none.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2-none.c,v 1.6 2003/08/26 09:58:43 markus Exp $");
+RCSID("$OpenBSD: auth2-none.c,v 1.7 2004/05/11 19:01:43 deraadt Exp $");
#include "auth.h"
#include "xmalloc.h"
@@ -46,7 +46,7 @@ auth2_read_banner(void)
{
struct stat st;
char *banner = NULL;
- off_t len, n;
+ size_t len, n;
int fd;
if ((fd = open(options.banner, O_RDONLY)) == -1)
@@ -55,7 +55,12 @@ auth2_read_banner(void)
close(fd);
return (NULL);
}
- len = st.st_size;
+ if (st.st_size > 1*1024*1024) {
+ close(fd);
+ return (NULL);
+ }
+
+ len = (size_t)st.st_size; /* truncate */
banner = xmalloc(len + 1);
n = atomicio(read, fd, banner, len);
close(fd);