summaryrefslogtreecommitdiff
path: root/auth2-none.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-05-13 16:39:33 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-05-13 16:39:33 +1000
commit1f8311c836a20ce4923e2142d206f8d8073d0ca4 (patch)
tree93c92ccf9709d18faa075fb2b3c5fda4d969b28a /auth2-none.c
parentb42714e28bcb22c5b52b0266813165cf5e7e9ccb (diff)
- deraadt@cvs.openbsd.org 2004/05/11 19:01:43
[auth.c auth2-none.c authfile.c channels.c monitor.c monitor_mm.c packet.c packet.h progressmeter.c session.c openbsd-compat/xmmap.c] improve some code lint did not like; djm millert ok
Diffstat (limited to 'auth2-none.c')
-rw-r--r--auth2-none.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/auth2-none.c b/auth2-none.c
index c342addec..2bf5b5c80 100644
--- a/auth2-none.c
+++ b/auth2-none.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2-none.c,v 1.6 2003/08/26 09:58:43 markus Exp $"); 26RCSID("$OpenBSD: auth2-none.c,v 1.7 2004/05/11 19:01:43 deraadt Exp $");
27 27
28#include "auth.h" 28#include "auth.h"
29#include "xmalloc.h" 29#include "xmalloc.h"
@@ -46,7 +46,7 @@ auth2_read_banner(void)
46{ 46{
47 struct stat st; 47 struct stat st;
48 char *banner = NULL; 48 char *banner = NULL;
49 off_t len, n; 49 size_t len, n;
50 int fd; 50 int fd;
51 51
52 if ((fd = open(options.banner, O_RDONLY)) == -1) 52 if ((fd = open(options.banner, O_RDONLY)) == -1)
@@ -55,7 +55,12 @@ auth2_read_banner(void)
55 close(fd); 55 close(fd);
56 return (NULL); 56 return (NULL);
57 } 57 }
58 len = st.st_size; 58 if (st.st_size > 1*1024*1024) {
59 close(fd);
60 return (NULL);
61 }
62
63 len = (size_t)st.st_size; /* truncate */
59 banner = xmalloc(len + 1); 64 banner = xmalloc(len + 1);
60 n = atomicio(read, fd, banner, len); 65 n = atomicio(read, fd, banner, len);
61 close(fd); 66 close(fd);