diff options
author | Alistair Delva <adelva@google.com> | 2020-08-21 00:00:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-08-21 00:00:13 +0000 |
commit | ed358b3546c776c1c677fd88eb8f716cf6187510 (patch) | |
tree | 3c6134bcb2cda4b9dccc57b4a8b997a945aab62d /msg.c | |
parent | 22246b08952d746a7cc5a292570636cf4277598f (diff) | |
parent | 44a1065de8a58c51a021243a28bfa01e87822e4f (diff) |
Merge changes I934c73d4,I28cdc9a0,I9e734da9,I3c079d86
* changes:
UPSTREAM: depend
UPSTREAM: upstream: avoid possible NULL deref; from Pedro Martelletto
Revert "upstream: fix compilation with DEBUG_KEXDH; bz#3160 ok dtucker@"
Merge upstream-master into master
Diffstat (limited to 'msg.c')
-rw-r--r-- | msg.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: msg.c,v 1.16 2015/01/15 09:40:00 djm Exp $ */ +/* $OpenBSD: msg.c,v 1.18 2020/01/22 04:49:16 djm Exp $ */ /* * Copyright (c) 2002 Markus Friedl. All rights reserved. * @@ -47,16 +47,16 @@ ssh_msg_send(int fd, u_char type, struct sshbuf *m) u_char buf[5]; u_int mlen = sshbuf_len(m); - debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff); + debug3("%s: type %u", __func__, (unsigned int)type & 0xff); put_u32(buf, mlen + 1); buf[4] = type; /* 1st byte of payload is mesg-type */ if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) { - error("ssh_msg_send: write"); + error("%s: write: %s", __func__, strerror(errno)); return (-1); } - if (atomicio(vwrite, fd, (u_char *)sshbuf_ptr(m), mlen) != mlen) { - error("ssh_msg_send: write"); + if (atomicio(vwrite, fd, sshbuf_mutable_ptr(m), mlen) != mlen) { + error("%s: write: %s", __func__, strerror(errno)); return (-1); } return (0); @@ -73,12 +73,12 @@ ssh_msg_recv(int fd, struct sshbuf *m) if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) { if (errno != EPIPE) - error("ssh_msg_recv: read: header"); + error("%s: read header: %s", __func__, strerror(errno)); return (-1); } msg_len = get_u32(buf); if (msg_len > 256 * 1024) { - error("ssh_msg_recv: read: bad msg_len %u", msg_len); + error("%s: read: bad msg_len %u", __func__, msg_len); return (-1); } sshbuf_reset(m); @@ -87,7 +87,7 @@ ssh_msg_recv(int fd, struct sshbuf *m) return -1; } if (atomicio(read, fd, p, msg_len) != msg_len) { - error("ssh_msg_recv: read: %s", strerror(errno)); + error("%s: read: %s", __func__, strerror(errno)); return (-1); } return (0); |