diff options
author | Damien Miller <djm@mindrot.org> | 2014-05-15 13:48:26 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-05-15 13:48:26 +1000 |
commit | 633de33b192d808d87537834c316dc8b75fe1880 (patch) | |
tree | 54d456735ab7e2848dc8df5eba9c3dbb314b29e1 | |
parent | 15271907843e4ae50dcfc83b3594014cf5e9607b (diff) |
- 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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | authfile.c | 5 | ||||
-rw-r--r-- | bufaux.c | 8 | ||||
-rw-r--r-- | buffer.h | 6 | ||||
-rw-r--r-- | channels.c | 4 | ||||
-rw-r--r-- | krl.c | 8 | ||||
-rw-r--r-- | mux.c | 6 | ||||
-rw-r--r-- | packet.c | 4 | ||||
-rw-r--r-- | packet.h | 4 | ||||
-rw-r--r-- | ssh-keygen.c | 12 |
10 files changed, 36 insertions, 27 deletions
@@ -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 @@ -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; @@ -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"); @@ -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 *); @@ -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; @@ -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; @@ -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); @@ -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); @@ -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)); |