]> andersk Git - openssh.git/commitdiff
- deraadt@cvs.openbsd.org 2004/05/11 19:01:43
authordtucker <dtucker>
Thu, 13 May 2004 06:39:33 +0000 (06:39 +0000)
committerdtucker <dtucker>
Thu, 13 May 2004 06:39:33 +0000 (06:39 +0000)
     [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

12 files changed:
ChangeLog
auth.c
auth2-none.c
authfile.c
channels.c
monitor.c
monitor_mm.c
openbsd-compat/xmmap.c
packet.c
packet.h
progressmeter.c
session.c

index 7388ca86cd9c2a32706971cc61cbe2b903df6a55..06db83316e68bdbe773be86cd1d140c0958f9837 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - djm@cvs.openbsd.org 2004/05/09 01:26:48
      [kex.c]
      don't overwrite what we are trying to compute
+   - 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
 
 20040502
  - (dtucker) OpenBSD CVS Sync
diff --git a/auth.c b/auth.c
index 8acfcf86c8d4bf9877076085be9b77d0fd1c570c..4f93ce5ae963523997cf6d84a98c08ef78840166 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.52 2004/05/08 00:01:37 deraadt Exp $");
+RCSID("$OpenBSD: auth.c,v 1.53 2004/05/11 19:01:43 deraadt Exp $");
 
 #ifdef HAVE_LOGIN_H
 #include <login.h>
@@ -562,8 +562,8 @@ fakepw(void)
        fake.pw_passwd =
            "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK";
        fake.pw_gecos = "NOUSER";
-       fake.pw_uid = -1;
-       fake.pw_gid = -1;
+       fake.pw_uid = (uid_t)-1;
+       fake.pw_gid = (gid_t)-1;
 #ifdef HAVE_PW_CLASS_IN_PASSWD
        fake.pw_class = "";
 #endif
index c342addeca5ad43b9addfe0906e7506a09301a05..2bf5b5c80c931123438a6606e031e49ded76601b 100644 (file)
@@ -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);
index 83ddd635f380ff4320a7691fc530da6813722f47..305e9473b2bc65ed2267ee7e4aa4a58dbdb5f3e5 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: authfile.c,v 1.55 2003/09/18 07:56:05 markus Exp $");
+RCSID("$OpenBSD: authfile.c,v 1.56 2004/05/11 19:01:43 deraadt Exp $");
 
 #include <openssl/err.h>
 #include <openssl/evp.h>
@@ -236,14 +236,16 @@ key_load_public_rsa1(int fd, const char *filename, char **commentp)
        struct stat st;
        char *cp;
        int i;
-       off_t len;
+       size_t len;
 
        if (fstat(fd, &st) < 0) {
                error("fstat for key file %.200s failed: %.100s",
                    filename, strerror(errno));
                return NULL;
        }
-       len = st.st_size;
+       if (st.st_size > 1*1024*1024)
+               close(fd);
+       len = (size_t)st.st_size;               /* truncated */
 
        buffer_init(&buffer);
        cp = buffer_append_space(&buffer, len);
@@ -318,7 +320,7 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase,
     char **commentp)
 {
        int i, check1, check2, cipher_type;
-       off_t len;
+       size_t len;
        Buffer buffer, decrypted;
        u_char *cp;
        CipherContext ciphercontext;
@@ -332,7 +334,11 @@ key_load_private_rsa1(int fd, const char *filename, const char *passphrase,
                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;               /* truncated */
 
        buffer_init(&buffer);
        cp = buffer_append_space(&buffer, len);
index e663c21596c2065a2cd6cec5810f8df5c00264c7..55dc6734220f30aea495848c40dddc72504fb6c1 100644 (file)
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.200 2004/01/19 09:24:21 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.201 2004/05/11 19:01:43 deraadt Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -1031,7 +1031,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
        buffer_get(&c->input, (char *)&dest_port, 2);
        dest_addr[addrlen] = '\0';
        if (s5_req.atyp == SSH_SOCKS5_DOMAIN)
-               strlcpy(c->path, dest_addr, sizeof(c->path));
+               strlcpy(c->path, (char *)dest_addr, sizeof(c->path));
        else if (inet_ntop(af, dest_addr, c->path, sizeof(c->path)) == NULL)
                return -1;
        c->host_port = ntohs(dest_port);
index 4636000bb836b0f2afbf534111f2d4e7c8ae05f1..2200eb09d68a06dc8fcac9bfd058d402bcf4fe27 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: monitor.c,v 1.56 2004/05/09 01:19:27 djm Exp $");
+RCSID("$OpenBSD: monitor.c,v 1.57 2004/05/11 19:01:43 deraadt Exp $");
 
 #include <openssl/dh.h>
 
@@ -1479,7 +1479,7 @@ mm_answer_term(int socket, Buffer *req)
        res = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
 
        /* Terminate process */
-       exit (res);
+       exit(res);
 }
 
 void
index e57c87cc2a0c9150bf87f78477fcc4a6d36d2fe2..ff523a5b1e4c511da51e5a88f04af9bf51fb1471 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: monitor_mm.c,v 1.8 2002/08/02 14:43:15 millert Exp $");
+RCSID("$OpenBSD: monitor_mm.c,v 1.9 2004/05/11 19:01:43 deraadt Exp $");
 
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
index 0e22ec686710fe123812b0145ce590e352c800f4..07902db8ae51941d6e5af3149a5dd13b32f2ba9f 100644 (file)
@@ -40,10 +40,10 @@ void *xmmap(size_t size)
 #ifdef HAVE_MMAP
 # ifdef MAP_ANON
        address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
-           -1, 0);
+           -1, (off_t)0);
 # else
        address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
-           open("/dev/zero", O_RDWR), 0);
+           open("/dev/zero", O_RDWR), (off_t)0);
 # endif
 
 #define MM_SWAP_TEMPLATE "/var/run/sshd.mm.XXXXXXXX"
@@ -58,7 +58,7 @@ void *xmmap(size_t size)
                unlink(tmpname);
                ftruncate(tmpfd, size);
                address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
-                   tmpfd, 0);
+                   tmpfd, (off_t)0);
                close(tmpfd);
        }
 
index daae9ffaaa2ad06d2b27c1f2ac53849477e1545e..fe3eea0944fa6c286bfb8c2b279d945ae8631c89 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: packet.c,v 1.112 2003/09/23 20:17:11 markus Exp $");
+RCSID("$OpenBSD: packet.c,v 1.113 2004/05/11 19:01:43 deraadt Exp $");
 
 #include "openbsd-compat/sys-queue.h"
 
@@ -154,8 +154,10 @@ packet_set_connection(int fd_in, int fd_out)
                fatal("packet_set_connection: cannot load cipher 'none'");
        connection_in = fd_in;
        connection_out = fd_out;
-       cipher_init(&send_context, none, "", 0, NULL, 0, CIPHER_ENCRYPT);
-       cipher_init(&receive_context, none, "", 0, NULL, 0, CIPHER_DECRYPT);
+       cipher_init(&send_context, none, (const u_char *)"",
+           0, NULL, 0, CIPHER_ENCRYPT);
+       cipher_init(&receive_context, none, (const u_char *)"",
+           0, NULL, 0, CIPHER_DECRYPT);
        newkeys[MODE_IN] = newkeys[MODE_OUT] = NULL;
        if (!initialized) {
                initialized = 1;
@@ -1449,7 +1451,7 @@ packet_is_interactive(void)
        return interactive_mode;
 }
 
-u_int
+int
 packet_set_maxsize(u_int s)
 {
        static int called = 0;
@@ -1503,7 +1505,7 @@ packet_send_ignore(int nbytes)
        }
 }
 
-#define MAX_PACKETS    (1<<31)
+#define MAX_PACKETS    (1U<<31)
 int
 packet_need_rekeying(void)
 {
index 7732fafb71fecce15af624cd67b611c56877e15a..37f82f2f603593bfd4bb508bf374922e46868793 100644 (file)
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
-/*     $OpenBSD: packet.h,v 1.40 2003/06/24 08:23:46 markus Exp $      */
+/*     $OpenBSD: packet.h,v 1.41 2004/05/11 19:01:43 deraadt Exp $     */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -82,7 +82,7 @@ void   tty_make_modes(int, struct termios *);
 void    tty_parse_modes(int, int *);
 
 extern u_int max_packet_size;
-u_int   packet_set_maxsize(u_int);
+int     packet_set_maxsize(u_int);
 #define  packet_get_maxsize() max_packet_size
 
 /* don't allow remaining bytes after the end of the message */
index f42668526c268852c587409b5b2abe2ada974e37..e74f4785f0e00f551dea5370f0ef1570a4e66e9f 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: progressmeter.c,v 1.19 2004/02/05 15:33:33 markus Exp $");
+RCSID("$OpenBSD: progressmeter.c,v 1.20 2004/05/11 19:01:43 deraadt Exp $");
 
 #include "progressmeter.h"
 #include "atomicio.h"
@@ -167,7 +167,7 @@ refresh_progress_meter(void)
 
        /* bandwidth usage */
        format_rate(buf + strlen(buf), win_size - strlen(buf),
-           bytes_per_second);
+           (off_t)bytes_per_second);
        strlcat(buf, "/s ", win_size);
 
        /* ETA */
index 2ecf637f987ac4da3b3ffd00ea4d7d025f80561f..2fe511612689501a371f6b5018ad2e136835c922 100644 (file)
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.174 2004/05/09 01:19:28 djm Exp $");
+RCSID("$OpenBSD: session.c,v 1.175 2004/05/11 19:01:43 deraadt Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -1824,9 +1824,8 @@ session_exec_req(Session *s)
 static int
 session_break_req(Session *s)
 {
-       u_int break_length;
 
-       break_length = packet_get_int();        /* ignored */
+       packet_get_int();       /* ignored */
        packet_check_eom();
 
        if (s->ttyfd == -1 ||
This page took 0.665656 seconds and 5 git commands to generate.