summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--authfile.c5
-rw-r--r--bufaux.c8
-rw-r--r--buffer.h6
-rw-r--r--channels.c4
-rw-r--r--krl.c8
-rw-r--r--mux.c6
-rw-r--r--packet.c4
-rw-r--r--packet.h4
-rw-r--r--ssh-keygen.c12
10 files changed, 36 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index ba6e0607..c5d0c675 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,12 @@
- djm@cvs.openbsd.org 2014/04/23 12:42:34
[readconf.c]
don't record duplicate IdentityFiles
+ - djm@cvs.openbsd.org 2014/04/28 03:09:18
+ [authfile.c bufaux.c buffer.h channels.c krl.c mux.c packet.c packet.h]
+ [ssh-keygen.c]
+ buffer_get_string_ptr's return should be const to remind
+ callers that futzing with it will futz with the actual buffer
+ contents
20140430
- (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
diff --git a/authfile.c b/authfile.c
index 0e97ba4e..44994a81 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfile.c,v 1.104 2014/03/12 04:51:12 djm Exp $ */
+/* $OpenBSD: authfile.c,v 1.105 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -204,7 +204,8 @@ key_parse_private2(Buffer *blob, int type, const char *passphrase,
char **commentp)
{
u_char *key = NULL, *cp, *salt = NULL, pad, last;
- char *comment = NULL, *ciphername = NULL, *kdfname = NULL, *kdfp;
+ char *comment = NULL, *ciphername = NULL, *kdfname = NULL;
+ const u_char *kdfp;
u_int keylen = 0, ivlen, blocksize, slen, klen, len, rounds, nkeys;
u_int check1, check2, m1len, m2len;
size_t authlen;
diff --git a/bufaux.c b/bufaux.c
index f6a6f2ab..2c8f96cd 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bufaux.c,v 1.57 2014/04/16 23:22:45 djm Exp $ */
+/* $OpenBSD: bufaux.c,v 1.58 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -236,7 +236,7 @@ buffer_get_cstring(Buffer *buffer, u_int *length_ptr)
return ret;
}
-void *
+const void *
buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr)
{
void *ptr;
@@ -255,10 +255,10 @@ buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr)
return (ptr);
}
-void *
+const void *
buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr)
{
- void *ret;
+ const void *ret;
if ((ret = buffer_get_string_ptr_ret(buffer, length_ptr)) == NULL)
fatal("buffer_get_string_ptr: buffer error");
diff --git a/buffer.h b/buffer.h
index 7df8a38f..74a7b814 100644
--- a/buffer.h
+++ b/buffer.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.h,v 1.23 2014/01/12 08:13:13 djm Exp $ */
+/* $OpenBSD: buffer.h,v 1.24 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -66,7 +66,7 @@ int buffer_get_char(Buffer *);
void buffer_put_char(Buffer *, int);
void *buffer_get_string(Buffer *, u_int *);
-void *buffer_get_string_ptr(Buffer *, u_int *);
+const void *buffer_get_string_ptr(Buffer *, u_int *);
void buffer_put_string(Buffer *, const void *, u_int);
char *buffer_get_cstring(Buffer *, u_int *);
void buffer_put_cstring(Buffer *, const char *);
@@ -83,7 +83,7 @@ int buffer_get_int_ret(u_int *, Buffer *);
int buffer_get_int64_ret(u_int64_t *, Buffer *);
void *buffer_get_string_ret(Buffer *, u_int *);
char *buffer_get_cstring_ret(Buffer *, u_int *);
-void *buffer_get_string_ptr_ret(Buffer *, u_int *);
+const void *buffer_get_string_ptr_ret(Buffer *, u_int *);
int buffer_get_char_ret(u_char *, Buffer *);
void *buffer_get_bignum2_as_string_ret(Buffer *, u_int *);
diff --git a/channels.c b/channels.c
index 9efe89c9..1020071f 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.331 2014/02/26 20:29:29 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.332 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2315,7 +2315,7 @@ void
channel_input_data(int type, u_int32_t seq, void *ctxt)
{
int id;
- char *data;
+ const u_char *data;
u_int data_len, win_len;
Channel *c;
diff --git a/krl.c b/krl.c
index 3b4cded0..c7aa57e6 100644
--- a/krl.c
+++ b/krl.c
@@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $OpenBSD: krl.c,v 1.14 2014/01/31 16:39:19 tedu Exp $ */
+/* $OpenBSD: krl.c,v 1.15 2014/04/28 03:09:18 djm Exp $ */
#include "includes.h"
@@ -753,7 +753,8 @@ static int
parse_revoked_certs(Buffer *buf, struct ssh_krl *krl)
{
int ret = -1, nbits;
- u_char type, *blob;
+ u_char type;
+ const u_char *blob;
u_int blen;
Buffer subsect;
u_int64_t serial, serial_lo, serial_hi;
@@ -887,7 +888,8 @@ ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
char timestamp[64];
int ret = -1, r, sig_seen;
Key *key = NULL, **ca_used = NULL;
- u_char type, *blob, *rdata = NULL;
+ u_char type, *rdata = NULL;
+ const u_char *blob;
u_int i, j, sig_off, sects_off, rlen, blen, format_version, nca_used;
nca_used = 0;
diff --git a/mux.c b/mux.c
index 882fa61b..784e942b 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.44 2013/07/12 00:19:58 djm Exp $ */
+/* $OpenBSD: mux.c,v 1.45 2014/04/28 03:09:18 djm Exp $ */
/*
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
*
@@ -1010,7 +1010,7 @@ mux_master_read_cb(Channel *c)
{
struct mux_master_state *state = (struct mux_master_state *)c->mux_ctx;
Buffer in, out;
- void *ptr;
+ const u_char *ptr;
u_int type, rid, have, i;
int ret = -1;
@@ -1429,7 +1429,7 @@ mux_client_read_packet(int fd, Buffer *m)
{
Buffer queue;
u_int need, have;
- void *ptr;
+ const u_char *ptr;
int oerrno;
buffer_init(&queue);
diff --git a/packet.c b/packet.c
index 1275fca9..a70acf8b 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.193 2014/04/01 05:32:57 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.194 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1618,7 +1618,7 @@ packet_get_string(u_int *length_ptr)
return buffer_get_string(&active_state->incoming_packet, length_ptr);
}
-void *
+const void *
packet_get_string_ptr(u_int *length_ptr)
{
return buffer_get_string_ptr(&active_state->incoming_packet, length_ptr);
diff --git a/packet.h b/packet.h
index f8edf851..1d6082a8 100644
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.h,v 1.59 2013/07/12 00:19:59 djm Exp $ */
+/* $OpenBSD: packet.h,v 1.60 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -70,7 +70,7 @@ void packet_get_ecpoint(const EC_GROUP *, EC_POINT *);
void *packet_get_raw(u_int *length_ptr);
void *packet_get_string(u_int *length_ptr);
char *packet_get_cstring(u_int *length_ptr);
-void *packet_get_string_ptr(u_int *length_ptr);
+const void *packet_get_string_ptr(u_int *length_ptr);
void packet_disconnect(const char *fmt,...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2)));
void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2)));
diff --git a/ssh-keygen.c b/ssh-keygen.c
index d37b7f7f..85eaf2ef 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.244 2014/04/20 09:24:26 logan Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.245 2014/04/28 03:09:18 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1820,8 +1820,8 @@ add_cert_option(char *opt)
static void
show_options(const Buffer *optbuf, int v00, int in_critical)
{
- char *name;
- u_char *data;
+ char *name, *arg;
+ const u_char *data;
u_int dlen;
Buffer options, option;
@@ -1844,9 +1844,9 @@ show_options(const Buffer *optbuf, int v00, int in_critical)
else if ((v00 || in_critical) &&
(strcmp(name, "force-command") == 0 ||
strcmp(name, "source-address") == 0)) {
- data = buffer_get_string(&option, NULL);
- printf(" %s\n", data);
- free(data);
+ arg = buffer_get_cstring(&option, NULL);
+ printf(" %s\n", arg);
+ free(arg);
} else {
printf(" UNKNOWN OPTION (len %u)\n",
buffer_len(&option));