summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--auth-options.c4
-rw-r--r--auth2-chall.c4
-rw-r--r--authfd.c4
-rw-r--r--channels.c4
-rw-r--r--cipher-3des1.c4
-rw-r--r--clientloop.c8
-rw-r--r--gss-genr.c4
-rw-r--r--monitor_mm.c7
-rw-r--r--packet.c4
-rw-r--r--schnorr.c4
-rw-r--r--sftp-client.c12
-rw-r--r--sftp-glob.c4
-rw-r--r--umac.c4
14 files changed, 39 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index a7098f6d5..efce7df1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,11 @@
8 [cipher.c cipher.h kex.c kex.h mac.c mac.h servconf.c ssh.c] 8 [cipher.c cipher.h kex.c kex.h mac.c mac.h servconf.c ssh.c]
9 Output the effective values of Ciphers, MACs and KexAlgorithms when 9 Output the effective values of Ciphers, MACs and KexAlgorithms when
10 the default has not been overridden. ok markus@ 10 the default has not been overridden. ok markus@
11 - djm@cvs.openbsd.org 2013/11/08 00:39:15
12 [auth-options.c auth2-chall.c authfd.c channels.c cipher-3des1.c]
13 [clientloop.c gss-genr.c monitor_mm.c packet.c schnorr.c umac.c]
14 [sftp-client.c sftp-glob.c]
15 use calloc for all structure allocations; from markus@
11 16
1220131107 1720131107
13 - (djm) [ssh-pkcs11.c] Bring back "non-constant initialiser" fix (rev 1.5) 18 - (djm) [ssh-pkcs11.c] Bring back "non-constant initialiser" fix (rev 1.5)
diff --git a/auth-options.c b/auth-options.c
index b485f8d24..b370b5be6 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.60 2013/11/02 22:34:01 markus Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.61 2013/11/08 00:39:14 djm 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
@@ -235,7 +235,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
235 auth_debug_add("Adding to environment: %.900s", s); 235 auth_debug_add("Adding to environment: %.900s", s);
236 debug("Adding to environment: %.900s", s); 236 debug("Adding to environment: %.900s", s);
237 opts++; 237 opts++;
238 new_envstring = xmalloc(sizeof(struct envstring)); 238 new_envstring = xcalloc(1, sizeof(struct envstring));
239 new_envstring->s = s; 239 new_envstring->s = s;
240 new_envstring->next = custom_environment; 240 new_envstring->next = custom_environment;
241 custom_environment = new_envstring; 241 custom_environment = new_envstring;
diff --git a/auth2-chall.c b/auth2-chall.c
index 98f3093ce..031c2828c 100644
--- a/auth2-chall.c
+++ b/auth2-chall.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-chall.c,v 1.38 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: auth2-chall.c,v 1.39 2013/11/08 00:39:14 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2001 Per Allansson. All rights reserved. 4 * Copyright (c) 2001 Per Allansson. All rights reserved.
@@ -111,7 +111,7 @@ kbdint_alloc(const char *devs)
111 remove_kbdint_device("pam"); 111 remove_kbdint_device("pam");
112#endif 112#endif
113 113
114 kbdintctxt = xmalloc(sizeof(KbdintAuthctxt)); 114 kbdintctxt = xcalloc(1, sizeof(KbdintAuthctxt));
115 if (strcmp(devs, "") == 0) { 115 if (strcmp(devs, "") == 0) {
116 buffer_init(&b); 116 buffer_init(&b);
117 for (i = 0; devices[i]; i++) { 117 for (i = 0; devices[i]; i++) {
diff --git a/authfd.c b/authfd.c
index 775786bee..5cce93b76 100644
--- a/authfd.c
+++ b/authfd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.c,v 1.87 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: authfd.c,v 1.88 2013/11/08 00:39:14 djm 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
@@ -206,7 +206,7 @@ ssh_get_authentication_connection(void)
206 if (sock < 0) 206 if (sock < 0)
207 return NULL; 207 return NULL;
208 208
209 auth = xmalloc(sizeof(*auth)); 209 auth = xcalloc(1, sizeof(*auth));
210 auth->fd = sock; 210 auth->fd = sock;
211 buffer_init(&auth->identities); 211 buffer_init(&auth->identities);
212 auth->howmany = 0; 212 auth->howmany = 0;
diff --git a/channels.c b/channels.c
index d227379d0..c9df9bac5 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.326 2013/09/19 01:24:46 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.327 2013/11/08 00:39:15 djm 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
@@ -704,7 +704,7 @@ channel_register_status_confirm(int id, channel_confirm_cb *cb,
704 if ((c = channel_lookup(id)) == NULL) 704 if ((c = channel_lookup(id)) == NULL)
705 fatal("channel_register_expect: %d: bad id", id); 705 fatal("channel_register_expect: %d: bad id", id);
706 706
707 cc = xmalloc(sizeof(*cc)); 707 cc = xcalloc(1, sizeof(*cc));
708 cc->cb = cb; 708 cc->cb = cb;
709 cc->abandon_cb = abandon_cb; 709 cc->abandon_cb = abandon_cb;
710 cc->ctx = ctx; 710 cc->ctx = ctx;
diff --git a/cipher-3des1.c b/cipher-3des1.c
index c8a70244b..56fc77786 100644
--- a/cipher-3des1.c
+++ b/cipher-3des1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher-3des1.c,v 1.8 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: cipher-3des1.c,v 1.9 2013/11/08 00:39:15 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2003 Markus Friedl. All rights reserved. 3 * Copyright (c) 2003 Markus Friedl. All rights reserved.
4 * 4 *
@@ -67,7 +67,7 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
67 u_char *k1, *k2, *k3; 67 u_char *k1, *k2, *k3;
68 68
69 if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) { 69 if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) {
70 c = xmalloc(sizeof(*c)); 70 c = xcalloc(1, sizeof(*c));
71 EVP_CIPHER_CTX_set_app_data(ctx, c); 71 EVP_CIPHER_CTX_set_app_data(ctx, c);
72 } 72 }
73 if (key == NULL) 73 if (key == NULL)
diff --git a/clientloop.c b/clientloop.c
index 45a55e0ec..8ad5d06b0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.254 2013/09/12 01:41:12 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.255 2013/11/08 00:39:15 djm 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
@@ -837,7 +837,7 @@ void
837client_expect_confirm(int id, const char *request, 837client_expect_confirm(int id, const char *request,
838 enum confirm_action action) 838 enum confirm_action action)
839{ 839{
840 struct channel_reply_ctx *cr = xmalloc(sizeof(*cr)); 840 struct channel_reply_ctx *cr = xcalloc(1, sizeof(*cr));
841 841
842 cr->request_type = request; 842 cr->request_type = request;
843 cr->action = action; 843 cr->action = action;
@@ -860,7 +860,7 @@ client_register_global_confirm(global_confirm_cb *cb, void *ctx)
860 return; 860 return;
861 } 861 }
862 862
863 gc = xmalloc(sizeof(*gc)); 863 gc = xcalloc(1, sizeof(*gc));
864 gc->cb = cb; 864 gc->cb = cb;
865 gc->ctx = ctx; 865 gc->ctx = ctx;
866 gc->ref_count = 1; 866 gc->ref_count = 1;
@@ -1438,7 +1438,7 @@ client_new_escape_filter_ctx(int escape_char)
1438{ 1438{
1439 struct escape_filter_ctx *ret; 1439 struct escape_filter_ctx *ret;
1440 1440
1441 ret = xmalloc(sizeof(*ret)); 1441 ret = xcalloc(1, sizeof(*ret));
1442 ret->escape_pending = 0; 1442 ret->escape_pending = 0;
1443 ret->escape_char = escape_char; 1443 ret->escape_char = escape_char;
1444 return (void *)ret; 1444 return (void *)ret;
diff --git a/gss-genr.c b/gss-genr.c
index bf164a77b..b39281bc1 100644
--- a/gss-genr.c
+++ b/gss-genr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-genr.c,v 1.21 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: gss-genr.c,v 1.22 2013/11/08 00:39:15 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
@@ -62,7 +62,7 @@ ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len)
62 free(ctx->oid->elements); 62 free(ctx->oid->elements);
63 free(ctx->oid); 63 free(ctx->oid);
64 } 64 }
65 ctx->oid = xmalloc(sizeof(gss_OID_desc)); 65 ctx->oid = xcalloc(1, sizeof(gss_OID_desc));
66 ctx->oid->length = len; 66 ctx->oid->length = len;
67 ctx->oid->elements = xmalloc(len); 67 ctx->oid->elements = xmalloc(len);
68 memcpy(ctx->oid->elements, data, len); 68 memcpy(ctx->oid->elements, data, len);
diff --git a/monitor_mm.c b/monitor_mm.c
index ee7bad4b4..d3e6aeee5 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_mm.c,v 1.17 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: monitor_mm.c,v 1.18 2013/11/08 00:39:15 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * All rights reserved. 4 * All rights reserved.
@@ -65,7 +65,7 @@ mm_make_entry(struct mm_master *mm, struct mmtree *head,
65 struct mm_share *tmp, *tmp2; 65 struct mm_share *tmp, *tmp2;
66 66
67 if (mm->mmalloc == NULL) 67 if (mm->mmalloc == NULL)
68 tmp = xmalloc(sizeof(struct mm_share)); 68 tmp = xcalloc(1, sizeof(struct mm_share));
69 else 69 else
70 tmp = mm_xmalloc(mm->mmalloc, sizeof(struct mm_share)); 70 tmp = mm_xmalloc(mm->mmalloc, sizeof(struct mm_share));
71 tmp->address = address; 71 tmp->address = address;
@@ -88,7 +88,7 @@ mm_create(struct mm_master *mmalloc, size_t size)
88 struct mm_master *mm; 88 struct mm_master *mm;
89 89
90 if (mmalloc == NULL) 90 if (mmalloc == NULL)
91 mm = xmalloc(sizeof(struct mm_master)); 91 mm = xcalloc(1, sizeof(struct mm_master));
92 else 92 else
93 mm = mm_xmalloc(mmalloc, sizeof(struct mm_master)); 93 mm = mm_xmalloc(mmalloc, sizeof(struct mm_master));
94 94
@@ -161,6 +161,7 @@ mm_xmalloc(struct mm_master *mm, size_t size)
161 address = mm_malloc(mm, size); 161 address = mm_malloc(mm, size);
162 if (address == NULL) 162 if (address == NULL)
163 fatal("%s: mm_malloc(%lu)", __func__, (u_long)size); 163 fatal("%s: mm_malloc(%lu)", __func__, (u_long)size);
164 memset(address, 0, size);
164 return (address); 165 return (address);
165} 166}
166 167
diff --git a/packet.c b/packet.c
index 0d27e7592..90db33bdd 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.188 2013/07/12 00:19:58 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.189 2013/11/08 00:39:15 djm 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
@@ -996,7 +996,7 @@ packet_send2(void)
996 (type == SSH2_MSG_SERVICE_REQUEST) || 996 (type == SSH2_MSG_SERVICE_REQUEST) ||
997 (type == SSH2_MSG_SERVICE_ACCEPT)) { 997 (type == SSH2_MSG_SERVICE_ACCEPT)) {
998 debug("enqueue packet: %u", type); 998 debug("enqueue packet: %u", type);
999 p = xmalloc(sizeof(*p)); 999 p = xcalloc(1, sizeof(*p));
1000 p->type = type; 1000 p->type = type;
1001 memcpy(&p->payload, &active_state->outgoing_packet, 1001 memcpy(&p->payload, &active_state->outgoing_packet,
1002 sizeof(Buffer)); 1002 sizeof(Buffer));
diff --git a/schnorr.c b/schnorr.c
index 9549dcf0e..93822fed4 100644
--- a/schnorr.c
+++ b/schnorr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: schnorr.c,v 1.7 2013/05/17 00:13:14 djm Exp $ */ 1/* $OpenBSD: schnorr.c,v 1.8 2013/11/08 00:39:15 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2008 Damien Miller. All rights reserved. 3 * Copyright (c) 2008 Damien Miller. All rights reserved.
4 * 4 *
@@ -549,7 +549,7 @@ modp_group_from_g_and_safe_p(const char *grp_g, const char *grp_p)
549{ 549{
550 struct modp_group *ret; 550 struct modp_group *ret;
551 551
552 ret = xmalloc(sizeof(*ret)); 552 ret = xcalloc(1, sizeof(*ret));
553 ret->p = ret->q = ret->g = NULL; 553 ret->p = ret->q = ret->g = NULL;
554 if (BN_hex2bn(&ret->p, grp_p) == 0 || 554 if (BN_hex2bn(&ret->p, grp_p) == 0 ||
555 BN_hex2bn(&ret->g, grp_g) == 0) 555 BN_hex2bn(&ret->g, grp_g) == 0)
diff --git a/sftp-client.c b/sftp-client.c
index 91955262c..542af8b18 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.107 2013/10/17 00:30:13 djm Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.108 2013/11/08 00:39:15 djm 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 *
@@ -477,7 +477,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
477 477
478 if (dir) { 478 if (dir) {
479 ents = 0; 479 ents = 0;
480 *dir = xmalloc(sizeof(**dir)); 480 *dir = xcalloc(1, sizeof(**dir));
481 (*dir)[0] = NULL; 481 (*dir)[0] = NULL;
482 } 482 }
483 483
@@ -551,7 +551,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
551 551
552 if (dir) { 552 if (dir) {
553 *dir = xrealloc(*dir, ents + 2, sizeof(**dir)); 553 *dir = xrealloc(*dir, ents + 2, sizeof(**dir));
554 (*dir)[ents] = xmalloc(sizeof(***dir)); 554 (*dir)[ents] = xcalloc(1, sizeof(***dir));
555 (*dir)[ents]->filename = xstrdup(filename); 555 (*dir)[ents]->filename = xstrdup(filename);
556 (*dir)[ents]->longname = xstrdup(longname); 556 (*dir)[ents]->longname = xstrdup(longname);
557 memcpy(&(*dir)[ents]->a, a, sizeof(*a)); 557 memcpy(&(*dir)[ents]->a, a, sizeof(*a));
@@ -570,7 +570,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
570 /* Don't return partial matches on interrupt */ 570 /* Don't return partial matches on interrupt */
571 if (interrupted && dir != NULL && *dir != NULL) { 571 if (interrupted && dir != NULL && *dir != NULL) {
572 free_sftp_dirents(*dir); 572 free_sftp_dirents(*dir);
573 *dir = xmalloc(sizeof(**dir)); 573 *dir = xcalloc(1, sizeof(**dir));
574 **dir = NULL; 574 **dir = NULL;
575 } 575 }
576 576
@@ -1143,7 +1143,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1143 (unsigned long long)offset, 1143 (unsigned long long)offset,
1144 (unsigned long long)offset + buflen - 1, 1144 (unsigned long long)offset + buflen - 1,
1145 num_req, max_req); 1145 num_req, max_req);
1146 req = xmalloc(sizeof(*req)); 1146 req = xcalloc(1, sizeof(*req));
1147 req->id = conn->msg_id++; 1147 req->id = conn->msg_id++;
1148 req->len = buflen; 1148 req->len = buflen;
1149 req->offset = offset; 1149 req->offset = offset;
@@ -1512,7 +1512,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1512 strerror(errno)); 1512 strerror(errno));
1513 1513
1514 if (len != 0) { 1514 if (len != 0) {
1515 ack = xmalloc(sizeof(*ack)); 1515 ack = xcalloc(1, sizeof(*ack));
1516 ack->id = ++id; 1516 ack->id = ++id;
1517 ack->offset = offset; 1517 ack->offset = offset;
1518 ack->len = len; 1518 ack->len = len;
diff --git a/sftp-glob.c b/sftp-glob.c
index 79b7bdb2f..e1f5a6109 100644
--- a/sftp-glob.c
+++ b/sftp-glob.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-glob.c,v 1.24 2013/05/17 00:13:14 djm Exp $ */ 1/* $OpenBSD: sftp-glob.c,v 1.25 2013/11/08 00:39:15 djm 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 *
@@ -48,7 +48,7 @@ fudge_opendir(const char *path)
48{ 48{
49 struct SFTP_OPENDIR *r; 49 struct SFTP_OPENDIR *r;
50 50
51 r = xmalloc(sizeof(*r)); 51 r = xcalloc(1, sizeof(*r));
52 52
53 if (do_readdir(cur.conn, (char *)path, &r->dir)) { 53 if (do_readdir(cur.conn, (char *)path, &r->dir)) {
54 free(r); 54 free(r);
diff --git a/umac.c b/umac.c
index 99416a510..0c62145fa 100644
--- a/umac.c
+++ b/umac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: umac.c,v 1.7 2013/07/22 05:00:17 djm Exp $ */ 1/* $OpenBSD: umac.c,v 1.8 2013/11/08 00:39:15 djm Exp $ */
2/* ----------------------------------------------------------------------- 2/* -----------------------------------------------------------------------
3 * 3 *
4 * umac.c -- C Implementation UMAC Message Authentication 4 * umac.c -- C Implementation UMAC Message Authentication
@@ -1227,7 +1227,7 @@ struct umac_ctx *umac_new(const u_char key[])
1227 size_t bytes_to_add; 1227 size_t bytes_to_add;
1228 aes_int_key prf_key; 1228 aes_int_key prf_key;
1229 1229
1230 octx = ctx = xmalloc(sizeof(*ctx) + ALLOC_BOUNDARY); 1230 octx = ctx = xcalloc(1, sizeof(*ctx) + ALLOC_BOUNDARY);
1231 if (ctx) { 1231 if (ctx) {
1232 if (ALLOC_BOUNDARY) { 1232 if (ALLOC_BOUNDARY) {
1233 bytes_to_add = ALLOC_BOUNDARY - 1233 bytes_to_add = ALLOC_BOUNDARY -