More explicit_bzero() for ssh

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

More explicit_bzero() for ssh

Michael McConville-2
Index: usr.bin/ssh/sshbuf-misc.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/sshbuf-misc.c,v
retrieving revision 1.4
diff -u -p -r1.4 sshbuf-misc.c
--- usr.bin/ssh/sshbuf-misc.c 24 Mar 2015 20:03:44 -0000 1.4
+++ usr.bin/ssh/sshbuf-misc.c 1 Oct 2015 00:10:24 -0000
@@ -99,7 +99,7 @@ sshbuf_dtob64(struct sshbuf *buf)
  if (SIZE_MAX / 2 <= len || (ret = malloc(plen)) == NULL)
  return NULL;
  if ((r = b64_ntop(p, len, ret, plen)) == -1) {
- bzero(ret, plen);
+ explicit_bzero(ret, plen);
  free(ret);
  return NULL;
  }
@@ -118,16 +118,16 @@ sshbuf_b64tod(struct sshbuf *buf, const
  if ((p = malloc(plen)) == NULL)
  return SSH_ERR_ALLOC_FAIL;
  if ((nlen = b64_pton(b64, p, plen)) < 0) {
- bzero(p, plen);
+ explicit_bzero(p, plen);
  free(p);
  return SSH_ERR_INVALID_FORMAT;
  }
  if ((r = sshbuf_put(buf, p, nlen)) < 0) {
- bzero(p, plen);
+ explicit_bzero(p, plen);
  free(p);
  return r;
  }
- bzero(p, plen);
+ explicit_bzero(p, plen);
  free(p);
  return 0;
 }
Index: usr.bin/ssh/sshbuf.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/sshbuf.c,v
retrieving revision 1.3
diff -u -p -r1.3 sshbuf.c
--- usr.bin/ssh/sshbuf.c 20 Jan 2015 23:14:00 -0000 1.3
+++ usr.bin/ssh/sshbuf.c 1 Oct 2015 00:10:24 -0000
@@ -175,7 +175,7 @@ sshbuf_free(struct sshbuf *buf)
  return;
  dont_free = buf->dont_free;
  if (!buf->readonly) {
- bzero(buf->d, buf->alloc);
+ explicit_bzero(buf->d, buf->alloc);
  free(buf->d);
  }
  bzero(buf, sizeof(*buf));