]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authorderaadt@openbsd.org <deraadt@openbsd.org>
Thu, 20 Aug 2015 22:32:42 +0000 (22:32 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 21 Aug 2015 03:43:25 +0000 (13:43 +1000)
Do not cast result of malloc/calloc/realloc* if stdlib.h
 is in scope ok krw millert

Upstream-ID: 5e50ded78cadf3841556649a16cc4b1cb6c58667

dns.c
packet.c
sftp-server.c
sftp.c
ssh-pkcs11-helper.c
sshconnect.c
sshd.c

diff --git a/dns.c b/dns.c
index f201b602e5f8b0a73ce94ee8d082a2b4feb9e40b..e813afeae690be6b0272032b93dc39d277dd5605 100644 (file)
--- a/dns.c
+++ b/dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dns.c,v 1.34 2015/01/28 22:36:00 djm Exp $ */
+/* $OpenBSD: dns.c,v 1.35 2015/08/20 22:32:42 deraadt Exp $ */
 
 /*
  * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -154,7 +154,7 @@ dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type,
                *digest_len = rdata_len - 2;
 
                if (*digest_len > 0) {
-                       *digest = (u_char *) xmalloc(*digest_len);
+                       *digest = xmalloc(*digest_len);
                        memcpy(*digest, rdata + 2, *digest_len);
                } else {
                        *digest = (u_char *)xstrdup("");
index 6008c2d946503768848da05060169f6038dfc48c..01d3e2970796ad1801bafefc6a76dc43c3cf43b7 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.213 2015/07/29 04:43:06 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.214 2015/08/20 22:32:42 deraadt Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1272,7 +1272,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
 
        DBG(debug("packet_read()"));
 
-       setp = (fd_set *)calloc(howmany(state->connection_in + 1,
+       setp = calloc(howmany(state->connection_in + 1,
            NFDBITS), sizeof(fd_mask));
        if (setp == NULL)
                return SSH_ERR_ALLOC_FAIL;
@@ -2036,7 +2036,7 @@ ssh_packet_write_wait(struct ssh *ssh)
        struct timeval start, timeout, *timeoutp = NULL;
        struct session_state *state = ssh->state;
 
-       setp = (fd_set *)calloc(howmany(state->connection_out + 1,
+       setp = calloc(howmany(state->connection_out + 1,
            NFDBITS), sizeof(fd_mask));
        if (setp == NULL)
                return SSH_ERR_ALLOC_FAIL;
index d1831bf8d8a306b74478dd6eccf021e08454fac2..eac11d7e695d2a3c8919b23bb822646f50ef2134 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.106 2015/04/24 01:36:01 deraadt Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.107 2015/08/20 22:32:42 deraadt Exp $ */
 /*
  * Copyright (c) 2000-2004 Markus Friedl.  All rights reserved.
  *
@@ -1632,8 +1632,8 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
                fatal("%s: sshbuf_new failed", __func__);
 
        set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask);
-       rset = (fd_set *)xmalloc(set_size);
-       wset = (fd_set *)xmalloc(set_size);
+       rset = xmalloc(set_size);
+       wset = xmalloc(set_size);
 
        if (homedir != NULL) {
                if (chdir(homedir) != 0) {
diff --git a/sftp.c b/sftp.c
index cb9b967edc99f9b98cc86a1bc4d818ab58adbe6a..788601a8d7fd31a8d55334f8c06f15536a7b6439 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.170 2015/01/20 23:14:00 deraadt Exp $ */
+/* $OpenBSD: sftp.c,v 1.171 2015/08/20 22:32:42 deraadt Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -1958,7 +1958,7 @@ complete(EditLine *el, int ch)
 
        /* Figure out which argument the cursor points to */
        cursor = lf->cursor - lf->buffer;
-       line = (char *)xmalloc(cursor + 1);
+       line = xmalloc(cursor + 1);
        memcpy(line, lf->buffer, cursor);
        line[cursor] = '\0';
        argv = makeargv(line, &carg, 1, &quote, &terminated);
@@ -1966,7 +1966,7 @@ complete(EditLine *el, int ch)
 
        /* Get all the arguments on the line */
        len = lf->lastchar - lf->buffer;
-       line = (char *)xmalloc(len + 1);
+       line = xmalloc(len + 1);
        memcpy(line, lf->buffer, len);
        line[len] = '\0';
        argv = makeargv(line, &argc, 1, NULL, NULL);
index ceabc8ba7fe4245a013a573ce259e3bd8771419d..f2d586395472366b84c5b3b75abf0dd7764ad9ac 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11-helper.c,v 1.10 2015/01/20 23:14:00 deraadt Exp $ */
+/* $OpenBSD: ssh-pkcs11-helper.c,v 1.11 2015/08/20 22:32:42 deraadt Exp $ */
 /*
  * Copyright (c) 2010 Markus Friedl.  All rights reserved.
  *
@@ -301,8 +301,8 @@ main(int argc, char **argv)
        buffer_init(&oqueue);
 
        set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask);
-       rset = (fd_set *)xmalloc(set_size);
-       wset = (fd_set *)xmalloc(set_size);
+       rset = xmalloc(set_size);
+       wset = xmalloc(set_size);
 
        for (;;) {
                memset(rset, 0, set_size);
index f41960c5df8f154bb648d3db03490cfc3b5eca88..17fbe39b007a82a945bb912d5df1eb6e969e4758 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.262 2015/05/28 05:41:29 dtucker Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.263 2015/08/20 22:32:42 deraadt Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -356,7 +356,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
                goto done;
        }
 
-       fdset = (fd_set *)xcalloc(howmany(sockfd + 1, NFDBITS),
+       fdset = xcalloc(howmany(sockfd + 1, NFDBITS),
            sizeof(fd_mask));
        FD_SET(sockfd, fdset);
        ms_to_timeval(&tv, *timeoutp);
diff --git a/sshd.c b/sshd.c
index c7dd8cb7a064e5868a50228b2b6da21efe1771ca..65ef7e8507068d4967b6941aa0b120322944a026 100644 (file)
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.457 2015/07/30 00:01:34 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.458 2015/08/20 22:32:42 deraadt Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1253,7 +1253,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
                        sighup_restart();
                if (fdset != NULL)
                        free(fdset);
-               fdset = (fd_set *)xcalloc(howmany(maxfd + 1, NFDBITS),
+               fdset = xcalloc(howmany(maxfd + 1, NFDBITS),
                    sizeof(fd_mask));
 
                for (i = 0; i < num_listen_socks; i++)