summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2015-08-20 22:32:42 +0000
committerDamien Miller <djm@mindrot.org>2015-08-21 13:43:25 +1000
commitce445b0ed927e45bd5bdce8f836eb353998dd65c (patch)
tree34170a772ddf573879b8ae244bafd6871be0fd11
parent05291e5288704d1a98bacda269eb5a0153599146 (diff)
upstream commit
Do not cast result of malloc/calloc/realloc* if stdlib.h is in scope ok krw millert Upstream-ID: 5e50ded78cadf3841556649a16cc4b1cb6c58667
-rw-r--r--dns.c4
-rw-r--r--packet.c6
-rw-r--r--sftp-server.c6
-rw-r--r--sftp.c6
-rw-r--r--ssh-pkcs11-helper.c6
-rw-r--r--sshconnect.c4
-rw-r--r--sshd.c4
7 files changed, 18 insertions, 18 deletions
diff --git a/dns.c b/dns.c
index f201b602e..e813afeae 100644
--- a/dns.c
+++ b/dns.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dns.c,v 1.34 2015/01/28 22:36:00 djm Exp $ */ 1/* $OpenBSD: dns.c,v 1.35 2015/08/20 22:32:42 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wesley Griffin. All rights reserved. 4 * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -154,7 +154,7 @@ dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type,
154 *digest_len = rdata_len - 2; 154 *digest_len = rdata_len - 2;
155 155
156 if (*digest_len > 0) { 156 if (*digest_len > 0) {
157 *digest = (u_char *) xmalloc(*digest_len); 157 *digest = xmalloc(*digest_len);
158 memcpy(*digest, rdata + 2, *digest_len); 158 memcpy(*digest, rdata + 2, *digest_len);
159 } else { 159 } else {
160 *digest = (u_char *)xstrdup(""); 160 *digest = (u_char *)xstrdup("");
diff --git a/packet.c b/packet.c
index 6008c2d94..01d3e2970 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.213 2015/07/29 04:43:06 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.214 2015/08/20 22:32:42 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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)
1272 1272
1273 DBG(debug("packet_read()")); 1273 DBG(debug("packet_read()"));
1274 1274
1275 setp = (fd_set *)calloc(howmany(state->connection_in + 1, 1275 setp = calloc(howmany(state->connection_in + 1,
1276 NFDBITS), sizeof(fd_mask)); 1276 NFDBITS), sizeof(fd_mask));
1277 if (setp == NULL) 1277 if (setp == NULL)
1278 return SSH_ERR_ALLOC_FAIL; 1278 return SSH_ERR_ALLOC_FAIL;
@@ -2036,7 +2036,7 @@ ssh_packet_write_wait(struct ssh *ssh)
2036 struct timeval start, timeout, *timeoutp = NULL; 2036 struct timeval start, timeout, *timeoutp = NULL;
2037 struct session_state *state = ssh->state; 2037 struct session_state *state = ssh->state;
2038 2038
2039 setp = (fd_set *)calloc(howmany(state->connection_out + 1, 2039 setp = calloc(howmany(state->connection_out + 1,
2040 NFDBITS), sizeof(fd_mask)); 2040 NFDBITS), sizeof(fd_mask));
2041 if (setp == NULL) 2041 if (setp == NULL)
2042 return SSH_ERR_ALLOC_FAIL; 2042 return SSH_ERR_ALLOC_FAIL;
diff --git a/sftp-server.c b/sftp-server.c
index d1831bf8d..eac11d7e6 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-server.c,v 1.106 2015/04/24 01:36:01 deraadt Exp $ */ 1/* $OpenBSD: sftp-server.c,v 1.107 2015/08/20 22:32:42 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
4 * 4 *
@@ -1632,8 +1632,8 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
1632 fatal("%s: sshbuf_new failed", __func__); 1632 fatal("%s: sshbuf_new failed", __func__);
1633 1633
1634 set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask); 1634 set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask);
1635 rset = (fd_set *)xmalloc(set_size); 1635 rset = xmalloc(set_size);
1636 wset = (fd_set *)xmalloc(set_size); 1636 wset = xmalloc(set_size);
1637 1637
1638 if (homedir != NULL) { 1638 if (homedir != NULL) {
1639 if (chdir(homedir) != 0) { 1639 if (chdir(homedir) != 0) {
diff --git a/sftp.c b/sftp.c
index cb9b967ed..788601a8d 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.170 2015/01/20 23:14:00 deraadt Exp $ */ 1/* $OpenBSD: sftp.c,v 1.171 2015/08/20 22:32:42 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -1958,7 +1958,7 @@ complete(EditLine *el, int ch)
1958 1958
1959 /* Figure out which argument the cursor points to */ 1959 /* Figure out which argument the cursor points to */
1960 cursor = lf->cursor - lf->buffer; 1960 cursor = lf->cursor - lf->buffer;
1961 line = (char *)xmalloc(cursor + 1); 1961 line = xmalloc(cursor + 1);
1962 memcpy(line, lf->buffer, cursor); 1962 memcpy(line, lf->buffer, cursor);
1963 line[cursor] = '\0'; 1963 line[cursor] = '\0';
1964 argv = makeargv(line, &carg, 1, &quote, &terminated); 1964 argv = makeargv(line, &carg, 1, &quote, &terminated);
@@ -1966,7 +1966,7 @@ complete(EditLine *el, int ch)
1966 1966
1967 /* Get all the arguments on the line */ 1967 /* Get all the arguments on the line */
1968 len = lf->lastchar - lf->buffer; 1968 len = lf->lastchar - lf->buffer;
1969 line = (char *)xmalloc(len + 1); 1969 line = xmalloc(len + 1);
1970 memcpy(line, lf->buffer, len); 1970 memcpy(line, lf->buffer, len);
1971 line[len] = '\0'; 1971 line[len] = '\0';
1972 argv = makeargv(line, &argc, 1, NULL, NULL); 1972 argv = makeargv(line, &argc, 1, NULL, NULL);
diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
index ceabc8ba7..f2d586395 100644
--- a/ssh-pkcs11-helper.c
+++ b/ssh-pkcs11-helper.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11-helper.c,v 1.10 2015/01/20 23:14:00 deraadt Exp $ */ 1/* $OpenBSD: ssh-pkcs11-helper.c,v 1.11 2015/08/20 22:32:42 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
@@ -301,8 +301,8 @@ main(int argc, char **argv)
301 buffer_init(&oqueue); 301 buffer_init(&oqueue);
302 302
303 set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask); 303 set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask);
304 rset = (fd_set *)xmalloc(set_size); 304 rset = xmalloc(set_size);
305 wset = (fd_set *)xmalloc(set_size); 305 wset = xmalloc(set_size);
306 306
307 for (;;) { 307 for (;;) {
308 memset(rset, 0, set_size); 308 memset(rset, 0, set_size);
diff --git a/sshconnect.c b/sshconnect.c
index f41960c5d..17fbe39b0 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.262 2015/05/28 05:41:29 dtucker Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.263 2015/08/20 22:32:42 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -356,7 +356,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
356 goto done; 356 goto done;
357 } 357 }
358 358
359 fdset = (fd_set *)xcalloc(howmany(sockfd + 1, NFDBITS), 359 fdset = xcalloc(howmany(sockfd + 1, NFDBITS),
360 sizeof(fd_mask)); 360 sizeof(fd_mask));
361 FD_SET(sockfd, fdset); 361 FD_SET(sockfd, fdset);
362 ms_to_timeval(&tv, *timeoutp); 362 ms_to_timeval(&tv, *timeoutp);
diff --git a/sshd.c b/sshd.c
index c7dd8cb7a..65ef7e850 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.457 2015/07/30 00:01:34 djm Exp $ */ 1/* $OpenBSD: sshd.c,v 1.458 2015/08/20 22:32:42 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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)
1253 sighup_restart(); 1253 sighup_restart();
1254 if (fdset != NULL) 1254 if (fdset != NULL)
1255 free(fdset); 1255 free(fdset);
1256 fdset = (fd_set *)xcalloc(howmany(maxfd + 1, NFDBITS), 1256 fdset = xcalloc(howmany(maxfd + 1, NFDBITS),
1257 sizeof(fd_mask)); 1257 sizeof(fd_mask));
1258 1258
1259 for (i = 0; i < num_listen_socks; i++) 1259 for (i = 0; i < num_listen_socks; i++)