diff options
author | 2018-07-09 21:56:06 +0000 | |
---|---|---|
committer | 2018-07-09 21:56:06 +0000 | |
commit | a74252e9279c077c136daf6c974bfc96576f6b73 (patch) | |
tree | 20316af095148fc53d926fb80b705c7d848f62e2 /usr.bin/ssh/sshbuf.c | |
parent | sshd: switch monitor to sshbuf API; lots of help & ok djm@ (diff) | |
download | wireguard-openbsd-a74252e9279c077c136daf6c974bfc96576f6b73.tar.xz wireguard-openbsd-a74252e9279c077c136daf6c974bfc96576f6b73.zip |
remove legacy buffer API emulation layer; ok djm@
Diffstat (limited to 'usr.bin/ssh/sshbuf.c')
-rw-r--r-- | usr.bin/ssh/sshbuf.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/usr.bin/ssh/sshbuf.c b/usr.bin/ssh/sshbuf.c index c4735fe7bd6..90990c310dc 100644 --- a/usr.bin/ssh/sshbuf.c +++ b/usr.bin/ssh/sshbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshbuf.c,v 1.11 2017/06/01 06:58:25 djm Exp $ */ +/* $OpenBSD: sshbuf.c,v 1.12 2018/07/09 21:56:06 markus Exp $ */ /* * Copyright (c) 2011 Damien Miller * @@ -34,7 +34,6 @@ sshbuf_check_sanity(const struct sshbuf *buf) (!buf->readonly && buf->d != buf->cd) || buf->refcount < 1 || buf->refcount > SSHBUF_REFS_MAX || buf->cd == NULL || - (buf->dont_free && (buf->readonly || buf->parent != NULL)) || buf->max_size > SSHBUF_SIZE_MAX || buf->alloc > buf->max_size || buf->size > buf->alloc || @@ -130,23 +129,8 @@ sshbuf_fromb(struct sshbuf *buf) } void -sshbuf_init(struct sshbuf *ret) -{ - explicit_bzero(ret, sizeof(*ret)); - ret->alloc = SSHBUF_SIZE_INIT; - ret->max_size = SSHBUF_SIZE_MAX; - ret->readonly = 0; - ret->dont_free = 1; - ret->refcount = 1; - if ((ret->cd = ret->d = calloc(1, ret->alloc)) == NULL) - ret->alloc = 0; -} - -void sshbuf_free(struct sshbuf *buf) { - int dont_free = 0; - if (buf == NULL) return; /* @@ -171,14 +155,12 @@ sshbuf_free(struct sshbuf *buf) buf->refcount--; if (buf->refcount > 0) return; - dont_free = buf->dont_free; if (!buf->readonly) { explicit_bzero(buf->d, buf->alloc); free(buf->d); } explicit_bzero(buf, sizeof(*buf)); - if (!dont_free) - free(buf); + free(buf); } void |