diff options
author | Matt Caswell <matt@openssl.org> | 2016-11-18 16:34:01 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-12-05 17:05:40 +0000 |
commit | 3171bad66e461052e584e1628693db67b990e94e (patch) | |
tree | 9e453c5ad0a658d5717ef9750da9e368a1147d0c /ssl/packet.c | |
parent | c53f7355b93885d1f12237f94b363ad747f03dad (diff) |
Add an ability to find out the current write location from a WPACKET
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/packet.c')
-rw-r--r-- | ssl/packet.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ssl/packet.c b/ssl/packet.c index 5c5513314b..f7b5efa400 100644 --- a/ssl/packet.c +++ b/ssl/packet.c @@ -62,7 +62,8 @@ int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } - *allocbytes = GETBUF(pkt) + pkt->curr; + if (allocbytes != NULL) + *allocbytes = GETBUF(pkt) + pkt->curr; return 1; } @@ -376,6 +377,11 @@ int WPACKET_get_length(WPACKET *pkt, size_t *len) return 1; } +unsigned char *WPACKET_get_curr(WPACKET *pkt) +{ + return GETBUF(pkt) + pkt->curr; +} + void WPACKET_cleanup(WPACKET *pkt) { WPACKET_SUB *sub, *parent; |