search for: sshbuf_check_sanity

Displaying 3 results from an estimated 3 matches for "sshbuf_check_sanity".

2024 Feb 03
1
a little note on sshbuf_reset()
...ure if it would be useful, but here it is. sshbuf_reset() is currently implemented like this: void sshbuf_reset(struct sshbuf *buf) { u_char *d; if (buf->readonly || buf->refcount > 1) { /* Nonsensical. Just make buffer appear empty */ buf->off = buf->size; return; } if (sshbuf_check_sanity(buf) != 0) return; buf->off = buf->size = 0; if (buf->alloc != SSHBUF_SIZE_INIT) { if ((d = recallocarray(buf->d, buf->alloc, SSHBUF_SIZE_INIT, 1)) != NULL) { buf->cd = buf->d = d; buf->alloc = SSHBUF_SIZE_INIT; } } explicit_bzero(buf->d, buf->all...
2024 Aug 13
1
[PATCH] harden parent-child check in sshbuf.c
...somehwere in the code by now. Okay? Index: sshbuf.c =================================================================== RCS file: /cvs/src/usr.bin/ssh/sshbuf.c,v diff -u -p -u -p -r1.19 sshbuf.c --- sshbuf.c 2 Dec 2022 04:40:27 -0000 1.19 +++ sshbuf.c 13 Aug 2024 16:52:58 -0000 @@ -55,6 +55,7 @@ sshbuf_check_sanity(const struct sshbuf SSHBUF_TELL("sanity"); if (__predict_false(buf == NULL || (!buf->readonly && buf->d != buf->cd) || + buf->parent == buf || buf->refcount < 1 || buf->refcount > SSHBUF_REFS_MAX || buf->cd == NULL || buf-...
2024 Feb 01
1
A couple of questions about OpenSSH codebase
...e first place? If sshbuf instance is not read-only and doesn't have children, why it cannot allocate more memory than it's max_size? 3. There are a lot of very defensive checks in sshbuf code. A lot (if not all) of sshbuf_* functions that take a pointer to another sshbuf first check it with sshbuf_check_sanity(). As far as i understand, sshbuf object cannot become insane since all its functions preserve all invariants. It also cannot become insane through client code, since its members are hidden. 4. What is the reason behind not implementing sshkey as a tagged union? I mean encapsulating all key-type-sp...