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.c28
-rw-r--r--sftp-glob.c4
-rw-r--r--umac.c4
14 files changed, 45 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index cb413838e..9436d8af1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
3 - markus@cvs.openbsd.org 2013/11/06 16:52:11 3 - markus@cvs.openbsd.org 2013/11/06 16:52:11
4 [monitor_wrap.c] 4 [monitor_wrap.c]
5 fix rekeying for AES-GCM modes; ok deraadt 5 fix rekeying for AES-GCM modes; ok deraadt
6 - djm@cvs.openbsd.org 2013/11/08 00:39:15
7 [auth-options.c auth2-chall.c authfd.c channels.c cipher-3des1.c]
8 [clientloop.c gss-genr.c monitor_mm.c packet.c schnorr.c umac.c]
9 [sftp-client.c sftp-glob.c]
10 use calloc for all structure allocations; from markus@
6 11
720130913 1220130913
8 - (djm) [channels.c] Fix unaligned access on sparc machines in SOCKS5 code; 13 - (djm) [channels.c] Fix unaligned access on sparc machines in SOCKS5 code;
diff --git a/auth-options.c b/auth-options.c
index 80d59ee95..12e2e1dca 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.59 2013/07/12 00:19:58 djm 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
@@ -239,7 +239,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
239 auth_debug_add("Adding to environment: %.900s", s); 239 auth_debug_add("Adding to environment: %.900s", s);
240 debug("Adding to environment: %.900s", s); 240 debug("Adding to environment: %.900s", s);
241 opts++; 241 opts++;
242 new_envstring = xmalloc(sizeof(struct envstring)); 242 new_envstring = xcalloc(1, sizeof(struct envstring));
243 new_envstring->s = s; 243 new_envstring->s = s;
244 new_envstring->next = custom_environment; 244 new_envstring->next = custom_environment;
245 custom_environment = new_envstring; 245 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 ac675c742..a1c31d8a0 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.324 2013/07/12 00:19:58 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 7c1f8abba..23c2f2396 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.253 2013/06/07 15:37:52 dtucker 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 f2ce9deb7..2f9793778 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.103 2013/08/09 03:39: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 *
@@ -337,8 +337,7 @@ do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests,
337 Buffer msg; 337 Buffer msg;
338 struct sftp_conn *ret; 338 struct sftp_conn *ret;
339 339
340 ret = xcalloc(1, sizeof(*ret)); 340 ret = xmalloc(sizeof(*ret));
341 ret->msg_id = 1;
342 ret->fd_in = fd_in; 341 ret->fd_in = fd_in;
343 ret->fd_out = fd_out; 342 ret->fd_out = fd_out;
344 ret->transfer_buflen = transfer_buflen; 343 ret->transfer_buflen = transfer_buflen;
@@ -472,7 +471,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
472 471
473 if (dir) { 472 if (dir) {
474 ents = 0; 473 ents = 0;
475 *dir = xmalloc(sizeof(**dir)); 474 *dir = xcalloc(1, sizeof(**dir));
476 (*dir)[0] = NULL; 475 (*dir)[0] = NULL;
477 } 476 }
478 477
@@ -546,7 +545,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
546 545
547 if (dir) { 546 if (dir) {
548 *dir = xrealloc(*dir, ents + 2, sizeof(**dir)); 547 *dir = xrealloc(*dir, ents + 2, sizeof(**dir));
549 (*dir)[ents] = xmalloc(sizeof(***dir)); 548 (*dir)[ents] = xcalloc(1, sizeof(***dir));
550 (*dir)[ents]->filename = xstrdup(filename); 549 (*dir)[ents]->filename = xstrdup(filename);
551 (*dir)[ents]->longname = xstrdup(longname); 550 (*dir)[ents]->longname = xstrdup(longname);
552 memcpy(&(*dir)[ents]->a, a, sizeof(*a)); 551 memcpy(&(*dir)[ents]->a, a, sizeof(*a));
@@ -565,7 +564,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
565 /* Don't return partial matches on interrupt */ 564 /* Don't return partial matches on interrupt */
566 if (interrupted && dir != NULL && *dir != NULL) { 565 if (interrupted && dir != NULL && *dir != NULL) {
567 free_sftp_dirents(*dir); 566 free_sftp_dirents(*dir);
568 *dir = xmalloc(sizeof(**dir)); 567 *dir = xcalloc(1, sizeof(**dir));
569 **dir = NULL; 568 **dir = NULL;
570 } 569 }
571 570
@@ -769,18 +768,16 @@ do_realpath(struct sftp_conn *conn, char *path)
769} 768}
770 769
771int 770int
772do_rename(struct sftp_conn *conn, char *oldpath, char *newpath, 771do_rename(struct sftp_conn *conn, char *oldpath, char *newpath)
773 int force_legacy)
774{ 772{
775 Buffer msg; 773 Buffer msg;
776 u_int status, id; 774 u_int status, id;
777 int use_ext = (conn->exts & SFTP_EXT_POSIX_RENAME) && !force_legacy;
778 775
779 buffer_init(&msg); 776 buffer_init(&msg);
780 777
781 /* Send rename request */ 778 /* Send rename request */
782 id = conn->msg_id++; 779 id = conn->msg_id++;
783 if (use_ext) { 780 if ((conn->exts & SFTP_EXT_POSIX_RENAME)) {
784 buffer_put_char(&msg, SSH2_FXP_EXTENDED); 781 buffer_put_char(&msg, SSH2_FXP_EXTENDED);
785 buffer_put_int(&msg, id); 782 buffer_put_int(&msg, id);
786 buffer_put_cstring(&msg, "posix-rename@openssh.com"); 783 buffer_put_cstring(&msg, "posix-rename@openssh.com");
@@ -792,8 +789,8 @@ do_rename(struct sftp_conn *conn, char *oldpath, char *newpath,
792 buffer_put_cstring(&msg, newpath); 789 buffer_put_cstring(&msg, newpath);
793 send_msg(conn, &msg); 790 send_msg(conn, &msg);
794 debug3("Sent message %s \"%s\" -> \"%s\"", 791 debug3("Sent message %s \"%s\" -> \"%s\"",
795 use_ext ? "posix-rename@openssh.com" : "SSH2_FXP_RENAME", 792 (conn->exts & SFTP_EXT_POSIX_RENAME) ? "posix-rename@openssh.com" :
796 oldpath, newpath); 793 "SSH2_FXP_RENAME", oldpath, newpath);
797 buffer_free(&msg); 794 buffer_free(&msg);
798 795
799 status = get_status(conn, id); 796 status = get_status(conn, id);
@@ -1108,7 +1105,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1108 (unsigned long long)offset, 1105 (unsigned long long)offset,
1109 (unsigned long long)offset + buflen - 1, 1106 (unsigned long long)offset + buflen - 1,
1110 num_req, max_req); 1107 num_req, max_req);
1111 req = xmalloc(sizeof(*req)); 1108 req = xcalloc(1, sizeof(*req));
1112 req->id = conn->msg_id++; 1109 req->id = conn->msg_id++;
1113 req->len = buflen; 1110 req->len = buflen;
1114 req->offset = offset; 1111 req->offset = offset;
@@ -1222,7 +1219,6 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1222 if (read_error) { 1219 if (read_error) {
1223 error("Couldn't read from remote file \"%s\" : %s", 1220 error("Couldn't read from remote file \"%s\" : %s",
1224 remote_path, fx2txt(status)); 1221 remote_path, fx2txt(status));
1225 status = -1;
1226 do_close(conn, handle, handle_len); 1222 do_close(conn, handle, handle_len);
1227 } else if (write_error) { 1223 } else if (write_error) {
1228 error("Couldn't write to \"%s\": %s", local_path, 1224 error("Couldn't write to \"%s\": %s", local_path,
@@ -1231,7 +1227,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1231 do_close(conn, handle, handle_len); 1227 do_close(conn, handle, handle_len);
1232 } else { 1228 } else {
1233 status = do_close(conn, handle, handle_len); 1229 status = do_close(conn, handle, handle_len);
1234 if (interrupted || status != SSH2_FX_OK) 1230 if (interrupted)
1235 status = -1; 1231 status = -1;
1236 /* Override umask and utimes if asked */ 1232 /* Override umask and utimes if asked */
1237#ifdef HAVE_FCHMOD 1233#ifdef HAVE_FCHMOD
@@ -1467,7 +1463,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1467 strerror(errno)); 1463 strerror(errno));
1468 1464
1469 if (len != 0) { 1465 if (len != 0) {
1470 ack = xmalloc(sizeof(*ack)); 1466 ack = xcalloc(1, sizeof(*ack));
1471 ack->id = ++id; 1467 ack->id = ++id;
1472 ack->offset = offset; 1468 ack->offset = offset;
1473 ack->len = len; 1469 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 -