summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-05-15 13:48:26 +1000
committerDamien Miller <djm@mindrot.org>2014-05-15 13:48:26 +1000
commit633de33b192d808d87537834c316dc8b75fe1880 (patch)
tree54d456735ab7e2848dc8df5eba9c3dbb314b29e1
parent15271907843e4ae50dcfc83b3594014cf5e9607b (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--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 ba6e0607f..c5d0c675f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,12 @@
25 - djm@cvs.openbsd.org 2014/04/23 12:42:34 25 - djm@cvs.openbsd.org 2014/04/23 12:42:34
26 [readconf.c] 26 [readconf.c]
27 don't record duplicate IdentityFiles 27 don't record duplicate IdentityFiles
28 - djm@cvs.openbsd.org 2014/04/28 03:09:18
29 [authfile.c bufaux.c buffer.h channels.c krl.c mux.c packet.c packet.h]
30 [ssh-keygen.c]
31 buffer_get_string_ptr's return should be const to remind
32 callers that futzing with it will futz with the actual buffer
33 contents
28 34
2920140430 3520140430
30 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already 36 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
diff --git a/authfile.c b/authfile.c
index 0e97ba4ea..44994a810 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.104 2014/03/12 04:51:12 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.105 2014/04/28 03:09:18 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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,
204 char **commentp) 204 char **commentp)
205{ 205{
206 u_char *key = NULL, *cp, *salt = NULL, pad, last; 206 u_char *key = NULL, *cp, *salt = NULL, pad, last;
207 char *comment = NULL, *ciphername = NULL, *kdfname = NULL, *kdfp; 207 char *comment = NULL, *ciphername = NULL, *kdfname = NULL;
208 const u_char *kdfp;
208 u_int keylen = 0, ivlen, blocksize, slen, klen, len, rounds, nkeys; 209 u_int keylen = 0, ivlen, blocksize, slen, klen, len, rounds, nkeys;
209 u_int check1, check2, m1len, m2len; 210 u_int check1, check2, m1len, m2len;
210 size_t authlen; 211 size_t authlen;
diff --git a/bufaux.c b/bufaux.c
index f6a6f2ab2..2c8f96cde 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bufaux.c,v 1.57 2014/04/16 23:22:45 djm Exp $ */ 1/* $OpenBSD: bufaux.c,v 1.58 2014/04/28 03:09:18 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -236,7 +236,7 @@ buffer_get_cstring(Buffer *buffer, u_int *length_ptr)
236 return ret; 236 return ret;
237} 237}
238 238
239void * 239const void *
240buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr) 240buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr)
241{ 241{
242 void *ptr; 242 void *ptr;
@@ -255,10 +255,10 @@ buffer_get_string_ptr_ret(Buffer *buffer, u_int *length_ptr)
255 return (ptr); 255 return (ptr);
256} 256}
257 257
258void * 258const void *
259buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr) 259buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr)
260{ 260{
261 void *ret; 261 const void *ret;
262 262
263 if ((ret = buffer_get_string_ptr_ret(buffer, length_ptr)) == NULL) 263 if ((ret = buffer_get_string_ptr_ret(buffer, length_ptr)) == NULL)
264 fatal("buffer_get_string_ptr: buffer error"); 264 fatal("buffer_get_string_ptr: buffer error");
diff --git a/buffer.h b/buffer.h
index 7df8a38fa..74a7b8149 100644
--- a/buffer.h
+++ b/buffer.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: buffer.h,v 1.23 2014/01/12 08:13:13 djm Exp $ */ 1/* $OpenBSD: buffer.h,v 1.24 2014/04/28 03:09:18 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -66,7 +66,7 @@ int buffer_get_char(Buffer *);
66void buffer_put_char(Buffer *, int); 66void buffer_put_char(Buffer *, int);
67 67
68void *buffer_get_string(Buffer *, u_int *); 68void *buffer_get_string(Buffer *, u_int *);
69void *buffer_get_string_ptr(Buffer *, u_int *); 69const void *buffer_get_string_ptr(Buffer *, u_int *);
70void buffer_put_string(Buffer *, const void *, u_int); 70void buffer_put_string(Buffer *, const void *, u_int);
71char *buffer_get_cstring(Buffer *, u_int *); 71char *buffer_get_cstring(Buffer *, u_int *);
72void buffer_put_cstring(Buffer *, const char *); 72void buffer_put_cstring(Buffer *, const char *);
@@ -83,7 +83,7 @@ int buffer_get_int_ret(u_int *, Buffer *);
83int buffer_get_int64_ret(u_int64_t *, Buffer *); 83int buffer_get_int64_ret(u_int64_t *, Buffer *);
84void *buffer_get_string_ret(Buffer *, u_int *); 84void *buffer_get_string_ret(Buffer *, u_int *);
85char *buffer_get_cstring_ret(Buffer *, u_int *); 85char *buffer_get_cstring_ret(Buffer *, u_int *);
86void *buffer_get_string_ptr_ret(Buffer *, u_int *); 86const void *buffer_get_string_ptr_ret(Buffer *, u_int *);
87int buffer_get_char_ret(u_char *, Buffer *); 87int buffer_get_char_ret(u_char *, Buffer *);
88 88
89void *buffer_get_bignum2_as_string_ret(Buffer *, u_int *); 89void *buffer_get_bignum2_as_string_ret(Buffer *, u_int *);
diff --git a/channels.c b/channels.c
index 9efe89c9c..1020071ff 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.331 2014/02/26 20:29:29 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.332 2014/04/28 03:09:18 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2315,7 +2315,7 @@ void
2315channel_input_data(int type, u_int32_t seq, void *ctxt) 2315channel_input_data(int type, u_int32_t seq, void *ctxt)
2316{ 2316{
2317 int id; 2317 int id;
2318 char *data; 2318 const u_char *data;
2319 u_int data_len, win_len; 2319 u_int data_len, win_len;
2320 Channel *c; 2320 Channel *c;
2321 2321
diff --git a/krl.c b/krl.c
index 3b4cded05..c7aa57e66 100644
--- a/krl.c
+++ b/krl.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: krl.c,v 1.14 2014/01/31 16:39:19 tedu Exp $ */ 17/* $OpenBSD: krl.c,v 1.15 2014/04/28 03:09:18 djm Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -753,7 +753,8 @@ static int
753parse_revoked_certs(Buffer *buf, struct ssh_krl *krl) 753parse_revoked_certs(Buffer *buf, struct ssh_krl *krl)
754{ 754{
755 int ret = -1, nbits; 755 int ret = -1, nbits;
756 u_char type, *blob; 756 u_char type;
757 const u_char *blob;
757 u_int blen; 758 u_int blen;
758 Buffer subsect; 759 Buffer subsect;
759 u_int64_t serial, serial_lo, serial_hi; 760 u_int64_t serial, serial_lo, serial_hi;
@@ -887,7 +888,8 @@ ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
887 char timestamp[64]; 888 char timestamp[64];
888 int ret = -1, r, sig_seen; 889 int ret = -1, r, sig_seen;
889 Key *key = NULL, **ca_used = NULL; 890 Key *key = NULL, **ca_used = NULL;
890 u_char type, *blob, *rdata = NULL; 891 u_char type, *rdata = NULL;
892 const u_char *blob;
891 u_int i, j, sig_off, sects_off, rlen, blen, format_version, nca_used; 893 u_int i, j, sig_off, sects_off, rlen, blen, format_version, nca_used;
892 894
893 nca_used = 0; 895 nca_used = 0;
diff --git a/mux.c b/mux.c
index 882fa61b5..784e942ba 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.44 2013/07/12 00:19:58 djm Exp $ */ 1/* $OpenBSD: mux.c,v 1.45 2014/04/28 03:09:18 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -1010,7 +1010,7 @@ mux_master_read_cb(Channel *c)
1010{ 1010{
1011 struct mux_master_state *state = (struct mux_master_state *)c->mux_ctx; 1011 struct mux_master_state *state = (struct mux_master_state *)c->mux_ctx;
1012 Buffer in, out; 1012 Buffer in, out;
1013 void *ptr; 1013 const u_char *ptr;
1014 u_int type, rid, have, i; 1014 u_int type, rid, have, i;
1015 int ret = -1; 1015 int ret = -1;
1016 1016
@@ -1429,7 +1429,7 @@ mux_client_read_packet(int fd, Buffer *m)
1429{ 1429{
1430 Buffer queue; 1430 Buffer queue;
1431 u_int need, have; 1431 u_int need, have;
1432 void *ptr; 1432 const u_char *ptr;
1433 int oerrno; 1433 int oerrno;
1434 1434
1435 buffer_init(&queue); 1435 buffer_init(&queue);
diff --git a/packet.c b/packet.c
index 1275fca92..a70acf8b4 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.193 2014/04/01 05:32:57 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.194 2014/04/28 03:09:18 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1618,7 +1618,7 @@ packet_get_string(u_int *length_ptr)
1618 return buffer_get_string(&active_state->incoming_packet, length_ptr); 1618 return buffer_get_string(&active_state->incoming_packet, length_ptr);
1619} 1619}
1620 1620
1621void * 1621const void *
1622packet_get_string_ptr(u_int *length_ptr) 1622packet_get_string_ptr(u_int *length_ptr)
1623{ 1623{
1624 return buffer_get_string_ptr(&active_state->incoming_packet, length_ptr); 1624 return buffer_get_string_ptr(&active_state->incoming_packet, length_ptr);
diff --git a/packet.h b/packet.h
index f8edf851c..1d6082a8a 100644
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.h,v 1.59 2013/07/12 00:19:59 djm Exp $ */ 1/* $OpenBSD: packet.h,v 1.60 2014/04/28 03:09:18 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -70,7 +70,7 @@ void packet_get_ecpoint(const EC_GROUP *, EC_POINT *);
70void *packet_get_raw(u_int *length_ptr); 70void *packet_get_raw(u_int *length_ptr);
71void *packet_get_string(u_int *length_ptr); 71void *packet_get_string(u_int *length_ptr);
72char *packet_get_cstring(u_int *length_ptr); 72char *packet_get_cstring(u_int *length_ptr);
73void *packet_get_string_ptr(u_int *length_ptr); 73const void *packet_get_string_ptr(u_int *length_ptr);
74void packet_disconnect(const char *fmt,...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2))); 74void packet_disconnect(const char *fmt,...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2)));
75void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2))); 75void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2)));
76 76
diff --git a/ssh-keygen.c b/ssh-keygen.c
index d37b7f7f2..85eaf2ef5 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.244 2014/04/20 09:24:26 logan Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.245 2014/04/28 03:09:18 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1820,8 +1820,8 @@ add_cert_option(char *opt)
1820static void 1820static void
1821show_options(const Buffer *optbuf, int v00, int in_critical) 1821show_options(const Buffer *optbuf, int v00, int in_critical)
1822{ 1822{
1823 char *name; 1823 char *name, *arg;
1824 u_char *data; 1824 const u_char *data;
1825 u_int dlen; 1825 u_int dlen;
1826 Buffer options, option; 1826 Buffer options, option;
1827 1827
@@ -1844,9 +1844,9 @@ show_options(const Buffer *optbuf, int v00, int in_critical)
1844 else if ((v00 || in_critical) && 1844 else if ((v00 || in_critical) &&
1845 (strcmp(name, "force-command") == 0 || 1845 (strcmp(name, "force-command") == 0 ||
1846 strcmp(name, "source-address") == 0)) { 1846 strcmp(name, "source-address") == 0)) {
1847 data = buffer_get_string(&option, NULL); 1847 arg = buffer_get_cstring(&option, NULL);
1848 printf(" %s\n", data); 1848 printf(" %s\n", arg);
1849 free(data); 1849 free(arg);
1850 } else { 1850 } else {
1851 printf(" UNKNOWN OPTION (len %u)\n", 1851 printf(" UNKNOWN OPTION (len %u)\n",
1852 buffer_len(&option)); 1852 buffer_len(&option));