mirror of git://anongit.mindrot.org/openssh.git
upstream commit
Do not cast result of malloc/calloc/realloc* if stdlib.h is in scope ok krw millert Upstream-ID: 5e50ded78cadf3841556649a16cc4b1cb6c58667
This commit is contained in:
parent
05291e5288
commit
ce445b0ed9
4
dns.c
4
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("");
|
||||
|
|
6
packet.c
6
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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
6
sftp.c
6
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, "e, &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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
4
sshd.c
4
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++)
|
||||
|
|
Loading…
Reference in New Issue