Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/ssh pednatic check on command line args. correc...



details:   https://anonhg.NetBSD.org/src/rev/6c4d112bceee
branches:  trunk
changeset: 533463:6c4d112bceee
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jul 01 06:17:11 2002 +0000

description:
pednatic check on command line args.  correct signed/unsigned mixup.
sync w/ openbsd

diffstat:

 crypto/dist/ssh/auth-bsdauth.c   |   6 +++---
 crypto/dist/ssh/auth-skey.c      |   6 +++---
 crypto/dist/ssh/auth2-chall.c    |   6 +++---
 crypto/dist/ssh/auth2.c          |  11 +++++------
 crypto/dist/ssh/clientloop.c     |  10 +++++-----
 crypto/dist/ssh/dh.c             |   6 +++---
 crypto/dist/ssh/key.c            |  16 ++++++++--------
 crypto/dist/ssh/monitor.c        |   8 ++++----
 crypto/dist/ssh/monitor_fdpass.c |  17 +++++++++--------
 crypto/dist/ssh/monitor_mm.c     |  13 ++++++++++---
 crypto/dist/ssh/monitor_wrap.c   |  18 +++++++++---------
 crypto/dist/ssh/scard.h          |   8 ++++----
 crypto/dist/ssh/session.c        |  14 +++++++-------
 crypto/dist/ssh/sftp-glob.c      |  12 ++++++------
 crypto/dist/ssh/ssh-add.c        |   6 +++---
 crypto/dist/ssh/ssh-keyscan.c    |  13 ++++++++-----
 crypto/dist/ssh/ssh.c            |   9 +++++----
 crypto/dist/ssh/sshconnect.c     |   6 +++---
 crypto/dist/ssh/sshconnect2.c    |   6 +++---
 crypto/dist/ssh/sshd.c           |  37 ++++++++++++++++++++-----------------
 20 files changed, 121 insertions(+), 107 deletions(-)

diffs (truncated from 867 to 300 lines):

diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/auth-bsdauth.c
--- a/crypto/dist/ssh/auth-bsdauth.c    Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/auth-bsdauth.c    Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth-bsdauth.c,v 1.4 2002/06/24 05:48:26 itojun Exp $  */
+/*     $NetBSD: auth-bsdauth.c,v 1.5 2002/07/01 06:17:11 itojun Exp $  */
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
  *
@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: auth-bsdauth.c,v 1.4 2002/06/19 00:27:55 deraadt Exp $");
+RCSID("$OpenBSD: auth-bsdauth.c,v 1.5 2002/06/30 21:59:45 deraadt Exp $");
 
 #ifdef BSD_AUTH
 #include "xmalloc.h"
@@ -70,7 +70,7 @@
        *name = xstrdup("");
        *infotxt = xstrdup("");
        *numprompts = 1;
-       *prompts = xmalloc(*numprompts * sizeof(char*));
+       *prompts = xmalloc(*numprompts * sizeof(char *));
        *echo_on = xmalloc(*numprompts * sizeof(u_int));
        (*echo_on)[0] = 0;
        (*prompts)[0] = xstrdup(challenge);
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/auth-skey.c
--- a/crypto/dist/ssh/auth-skey.c       Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/auth-skey.c       Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth-skey.c,v 1.8 2002/06/24 05:48:27 itojun Exp $     */
+/*     $NetBSD: auth-skey.c,v 1.9 2002/07/01 06:17:11 itojun Exp $     */
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
  *
@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: auth-skey.c,v 1.19 2002/06/19 00:27:55 deraadt Exp $");
+RCSID("$OpenBSD: auth-skey.c,v 1.20 2002/06/30 21:59:45 deraadt Exp $");
 
 #ifdef SKEY
 
@@ -54,7 +54,7 @@
        *name  = xstrdup("");
        *infotxt  = xstrdup("");
        *numprompts = 1;
-       *prompts = xmalloc(*numprompts * sizeof(char*));
+       *prompts = xmalloc(*numprompts * sizeof(char *));
        *echo_on = xmalloc(*numprompts * sizeof(u_int));
        (*echo_on)[0] = 0;
 
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/auth2-chall.c
--- a/crypto/dist/ssh/auth2-chall.c     Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/auth2-chall.c     Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth2-chall.c,v 1.9 2002/06/26 14:08:29 itojun Exp $   */
+/*     $NetBSD: auth2-chall.c,v 1.10 2002/07/01 06:17:11 itojun Exp $  */
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
  * Copyright (c) 2001 Per Allansson.  All rights reserved.
@@ -24,7 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: auth2-chall.c,v 1.19 2002/06/26 13:55:37 markus Exp $");
+RCSID("$OpenBSD: auth2-chall.c,v 1.20 2002/06/30 21:59:45 deraadt Exp $");
 
 #include "ssh2.h"
 #include "auth.h"
@@ -264,7 +264,7 @@
        if (nresp > 100)
                fatal("input_userauth_info_response: too many replies");
        if (nresp > 0) {
-               response = xmalloc(nresp * sizeof(char*));
+               response = xmalloc(nresp * sizeof(char *));
                for (i = 0; i < nresp; i++)
                        response[i] = packet_get_string(NULL);
        }
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/auth2.c
--- a/crypto/dist/ssh/auth2.c   Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/auth2.c   Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth2.c,v 1.17 2002/06/24 05:48:28 itojun Exp $        */
+/*     $NetBSD: auth2.c,v 1.18 2002/07/01 06:17:11 itojun Exp $        */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -24,7 +24,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.93 2002/05/31 11:35:15 markus Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.94 2002/06/30 21:54:16 deraadt Exp $");
 
 #include "ssh2.h"
 #include "xmalloc.h"
@@ -36,7 +36,6 @@
 #include "dispatch.h"
 #include "pathnames.h"
 #include "monitor_wrap.h"
-#include "atomicio.h"
 
 /* import */
 extern ServerOptions options;
@@ -100,7 +99,7 @@
 {
        Authctxt *authctxt = ctxt;
        u_int len;
-       int accept = 0;
+       int acceptit = 0;
        char *service = packet_get_string(&len);
        packet_check_eom();
 
@@ -109,14 +108,14 @@
 
        if (strcmp(service, "ssh-userauth") == 0) {
                if (!authctxt->success) {
-                       accept = 1;
+                       acceptit = 1;
                        /* now we can handle user-auth requests */
                        dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &input_userauth_request);
                }
        }
        /* XXX all other service requests are denied */
 
-       if (accept) {
+       if (acceptit) {
                packet_start(SSH2_MSG_SERVICE_ACCEPT);
                packet_put_cstring(service);
                packet_send();
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/clientloop.c
--- a/crypto/dist/ssh/clientloop.c      Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/clientloop.c      Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clientloop.c,v 1.20 2002/06/26 14:08:30 itojun Exp $   */
+/*     $NetBSD: clientloop.c,v 1.21 2002/07/01 06:17:11 itojun Exp $   */
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
  * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -60,7 +60,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.102 2002/06/24 14:33:27 markus Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.103 2002/06/30 21:59:45 deraadt Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -1115,7 +1115,7 @@
 static Channel *
 client_request_forwarded_tcpip(const char *request_type, int rchan)
 {
-       Channel* c = NULL;
+       Channel *c = NULL;
        char *listen_address, *originator_address;
        int listen_port, originator_port;
        int sock;
@@ -1145,7 +1145,7 @@
        return c;
 }
 
-static Channel*
+static Channel *
 client_request_x11(const char *request_type, int rchan)
 {
        Channel *c = NULL;
@@ -1181,7 +1181,7 @@
        return c;
 }
 
-static Channel*
+static Channel *
 client_request_agent(const char *request_type, int rchan)
 {
        Channel *c = NULL;
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/dh.c
--- a/crypto/dist/ssh/dh.c      Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/dh.c      Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dh.c,v 1.8 2002/03/08 02:00:52 itojun Exp $    */
+/*     $NetBSD: dh.c,v 1.9 2002/07/01 06:17:11 itojun Exp $    */
 /*
  * Copyright (c) 2000 Niels Provos.  All rights reserved.
  *
@@ -24,7 +24,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: dh.c,v 1.21 2002/03/06 00:23:27 markus Exp $");
+RCSID("$OpenBSD: dh.c,v 1.22 2002/06/27 08:49:44 markus Exp $");
 
 #include "xmalloc.h"
 
@@ -51,7 +51,7 @@
        /* Ignore leading whitespace */
        if (*arg == '\0')
                arg = strdelim(&cp);
-       if (!*arg || *arg == '#')
+       if (!arg || !*arg || *arg == '#')
                return 0;
 
        /* time */
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/key.c
--- a/crypto/dist/ssh/key.c     Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/key.c     Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.15 2002/06/24 05:48:30 itojun Exp $  */
+/*     $NetBSD: key.c,v 1.16 2002/07/01 06:17:11 itojun Exp $  */
 /*
  * read_bignum():
  * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -33,7 +33,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.45 2002/06/23 03:26:19 deraadt Exp $");
+RCSID("$OpenBSD: key.c,v 1.46 2002/06/30 21:59:45 deraadt Exp $");
 
 #include <openssl/evp.h>
 
@@ -172,7 +172,7 @@
        return 0;
 }
 
-static u_char*
+static u_char *
 key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length)
 {
        const EVP_MD *md = NULL;
@@ -228,8 +228,8 @@
        return retval;
 }
 
-static char*
-key_fingerprint_hex(u_char* dgst_raw, u_int dgst_raw_len)
+static char *
+key_fingerprint_hex(u_char *dgst_raw, u_int dgst_raw_len)
 {
        char *retval;
        int i;
@@ -245,8 +245,8 @@
        return retval;
 }
 
-static char*
-key_fingerprint_bubblebabble(u_char* dgst_raw, u_int dgst_raw_len)
+static char *
+key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
 {
        char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
        char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
@@ -292,7 +292,7 @@
        return retval;
 }
 
-char*
+char *
 key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
 {
        char *retval = NULL;
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/monitor.c
--- a/crypto/dist/ssh/monitor.c Mon Jul 01 05:56:45 2002 +0000
+++ b/crypto/dist/ssh/monitor.c Mon Jul 01 06:17:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: monitor.c,v 1.6 2002/07/01 05:56:45 itojun Exp $       */
+/*     $NetBSD: monitor.c,v 1.7 2002/07/01 06:17:12 itojun Exp $       */
 /*
  * Copyright 2002 Niels Provos <provos%citi.umich.edu@localhost>
  * Copyright 2002 Markus Friedl <markus%openbsd.org@localhost>
@@ -442,7 +442,7 @@
        p = buffer_get_string(m, &datlen);
 
        if (datlen != 20)
-               fatal("%s: data length incorrect: %d", __func__, datlen);
+               fatal("%s: data length incorrect: %u", __func__, datlen);
 
        /* save session id, it will be passed on the first call */
        if (session_id2_len == 0) {
@@ -456,7 +456,7 @@
        if (key_sign(key, &signature, &siglen, p, datlen) < 0)
                fatal("%s: key_sign failed", __func__);
 
-       debug3("%s: signature %p(%d)", __func__, signature, siglen);
+       debug3("%s: signature %p(%u)", __func__, signature, siglen);
 
        buffer_clear(m);
        buffer_put_string(m, signature, siglen);
@@ -1422,7 +1422,7 @@
        int len = size * ncount;
        void *address;
 
-       if (len <= 0)
+       if (len <= 0 || size > 65535 || ncount > 65535)
                fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
 
        address = mm_malloc(mm, len);
diff -r 2a36de4cae45 -r 6c4d112bceee crypto/dist/ssh/monitor_fdpass.c



Home | Main Index | Thread Index | Old Index