summaryrefslogtreecommitdiff
path: root/sshbuf.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-05-02 08:49:03 +0000
committerDamien Miller <djm@mindrot.org>2016-05-02 20:35:04 +1000
commit1a31d02b2411c4718de58ce796dbb7b5e14db93e (patch)
treec6e06a9890e71bc97cd3cdc6ce74919e504c8fd8 /sshbuf.h
parentd2d6bf864e52af8491a60dd507f85b74361f5da3 (diff)
upstream commit
fix signed/unsigned errors reported by clang-3.7; add sshbuf_dup_string() to replace a common idiom of strdup(sshbuf_ptr()) with better safety checking; feedback and ok markus@ Upstream-ID: 71f926d9bb3f1efed51319a6daf37e93d57c8820
Diffstat (limited to 'sshbuf.h')
-rw-r--r--sshbuf.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sshbuf.h b/sshbuf.h
index 63495fbb0..52ff017cc 100644
--- a/sshbuf.h
+++ b/sshbuf.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf.h,v 1.6 2015/12/10 07:01:35 mmcc Exp $ */ 1/* $OpenBSD: sshbuf.h,v 1.7 2016/05/02 08:49:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -239,6 +239,13 @@ char *sshbuf_dtob64(struct sshbuf *buf);
239/* Decode base64 data and append it to the buffer */ 239/* Decode base64 data and append it to the buffer */
240int sshbuf_b64tod(struct sshbuf *buf, const char *b64); 240int sshbuf_b64tod(struct sshbuf *buf, const char *b64);
241 241
242/*
243 * Duplicate the contents of a buffer to a string (caller to free).
244 * Returns NULL on buffer error, or if the buffer contains a premature
245 * nul character.
246 */
247char *sshbuf_dup_string(struct sshbuf *buf);
248
242/* Macros for decoding/encoding integers */ 249/* Macros for decoding/encoding integers */
243#define PEEK_U64(p) \ 250#define PEEK_U64(p) \
244 (((u_int64_t)(((const u_char *)(p))[0]) << 56) | \ 251 (((u_int64_t)(((const u_char *)(p))[0]) << 56) | \