Pull up the following revisions(s) (requested by joerg in ticket #74): usr.sbin/sdpd/sdpd.h: revision 1.2 usr.sbin/sdpd/server.c: revision 1.11 Fix format string. Make sure problem doesn't reappear by using __printf_like as appropriate.diff -r1.1 -r1.1.10.1 src/usr.sbin/sdpd/sdpd.h
(sborrill)
--- src/usr.sbin/sdpd/sdpd.h 2009/05/12 10:05:07 1.1
+++ src/usr.sbin/sdpd/sdpd.h 2012/03/05 19:01:49 1.1.10.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sdpd.h,v 1.1 2009/05/12 10:05:07 plunky Exp $ */ | 1 | /* $NetBSD: sdpd.h,v 1.1.10.1 2012/03/05 19:01:49 sborrill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2006 Itronix Inc. | 4 | * Copyright (c) 2006 Itronix Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -124,34 +124,34 @@ uint16_t compat_change_request(server_t | @@ -124,34 +124,34 @@ uint16_t compat_change_request(server_t | |||
124 | 124 | |||
125 | /* db.c */ | 125 | /* db.c */ | |
126 | bool db_init(server_t *); | 126 | bool db_init(server_t *); | |
127 | bool db_next(server_t *, int, record_t **); | 127 | bool db_next(server_t *, int, record_t **); | |
128 | void db_select_ssp(server_t *, int, sdp_data_t *); | 128 | void db_select_ssp(server_t *, int, sdp_data_t *); | |
129 | void db_select_handle(server_t *, int, uint32_t); | 129 | void db_select_handle(server_t *, int, uint32_t); | |
130 | bool db_create(server_t *, int, const bdaddr_t *, uint32_t, sdp_data_t *); | 130 | bool db_create(server_t *, int, const bdaddr_t *, uint32_t, sdp_data_t *); | |
131 | void db_unselect(server_t *, int); | 131 | void db_unselect(server_t *, int); | |
132 | void db_release(server_t *, int); | 132 | void db_release(server_t *, int); | |
133 | 133 | |||
134 | /* log.c */ | 134 | /* log.c */ | |
135 | void log_open(char const *, bool); | 135 | void log_open(char const *, bool); | |
136 | void log_close(void); | 136 | void log_close(void); | |
137 | void log_emerg(char const *, ...); | 137 | void log_emerg(char const *, ...) __printflike(1, 2); | |
138 | void log_alert(char const *, ...); | 138 | void log_alert(char const *, ...) __printflike(1, 2); | |
139 | void log_crit(char const *, ...); | 139 | void log_crit(char const *, ...) __printflike(1, 2); | |
140 | void log_err(char const *, ...); | 140 | void log_err(char const *, ...) __printflike(1, 2); | |
141 | void log_warning(char const *, ...); | 141 | void log_warning(char const *, ...) __printflike(1, 2); | |
142 | void log_notice(char const *, ...); | 142 | void log_notice(char const *, ...) __printflike(1, 2); | |
143 | void log_info(char const *, ...); | 143 | void log_info(char const *, ...) __printflike(1, 2); | |
144 | void log_debug(char const *, ...); | 144 | void log_debug(char const *, ...) __printflike(1, 2); | |
145 | 145 | |||
146 | /* record.c */ | 146 | /* record.c */ | |
147 | uint16_t record_insert_request(server_t *, int); | 147 | uint16_t record_insert_request(server_t *, int); | |
148 | uint16_t record_update_request(server_t *, int); | 148 | uint16_t record_update_request(server_t *, int); | |
149 | uint16_t record_remove_request(server_t *, int); | 149 | uint16_t record_remove_request(server_t *, int); | |
150 | 150 | |||
151 | /* server.c */ | 151 | /* server.c */ | |
152 | bool server_init(server_t *, const char *, const char *); | 152 | bool server_init(server_t *, const char *, const char *); | |
153 | void server_shutdown(server_t *); | 153 | void server_shutdown(server_t *); | |
154 | bool server_do(server_t *); | 154 | bool server_do(server_t *); | |
155 | void server_error_response(server_t *, int, uint16_t); | 155 | void server_error_response(server_t *, int, uint16_t); | |
156 | 156 | |||
157 | /* service.c */ | 157 | /* service.c */ |
--- src/usr.sbin/sdpd/server.c 2011/07/01 03:07:21 1.10
+++ src/usr.sbin/sdpd/server.c 2012/03/05 19:01:49 1.10.4.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: server.c,v 1.10 2011/07/01 03:07:21 joerg Exp $ */ | 1 | /* $NetBSD: server.c,v 1.10.4.1 2012/03/05 19:01:49 sborrill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2006 Itronix Inc. | 4 | * Copyright (c) 2006 Itronix Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -48,27 +48,27 @@ | @@ -48,27 +48,27 @@ | |||
48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
55 | * SUCH DAMAGE. | 55 | * SUCH DAMAGE. | |
56 | * | 56 | * | |
57 | * $FreeBSD: src/usr.sbin/bluetooth/sdpd/server.c,v 1.2 2005/12/06 17:56:36 emax Exp $ | 57 | * $FreeBSD: src/usr.sbin/bluetooth/sdpd/server.c,v 1.2 2005/12/06 17:56:36 emax Exp $ | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | #include <sys/cdefs.h> | 60 | #include <sys/cdefs.h> | |
61 | __RCSID("$NetBSD: server.c,v 1.10 2011/07/01 03:07:21 joerg Exp $"); | 61 | __RCSID("$NetBSD: server.c,v 1.10.4.1 2012/03/05 19:01:49 sborrill Exp $"); | |
62 | 62 | |||
63 | #include <sys/select.h> | 63 | #include <sys/select.h> | |
64 | #include <sys/stat.h> | 64 | #include <sys/stat.h> | |
65 | #include <sys/ucred.h> | 65 | #include <sys/ucred.h> | |
66 | #include <sys/un.h> | 66 | #include <sys/un.h> | |
67 | 67 | |||
68 | #include <assert.h> | 68 | #include <assert.h> | |
69 | #include <bluetooth.h> | 69 | #include <bluetooth.h> | |
70 | #include <errno.h> | 70 | #include <errno.h> | |
71 | #include <grp.h> | 71 | #include <grp.h> | |
72 | #include <pwd.h> | 72 | #include <pwd.h> | |
73 | #include <sdp.h> | 73 | #include <sdp.h> | |
74 | #include <stdio.h> | 74 | #include <stdio.h> | |
@@ -102,27 +102,27 @@ server_init(server_t *srv, char const *c | @@ -102,27 +102,27 @@ server_init(server_t *srv, char const *c | |||
102 | FD_ZERO(&srv->fdset); | 102 | FD_ZERO(&srv->fdset); | |
103 | srv->sgroup = sgroup; | 103 | srv->sgroup = sgroup; | |
104 | 104 | |||
105 | srv->fdmax = -1; | 105 | srv->fdmax = -1; | |
106 | srv->fdidx = calloc(FD_SETSIZE, sizeof(fd_idx_t)); | 106 | srv->fdidx = calloc(FD_SETSIZE, sizeof(fd_idx_t)); | |
107 | if (srv->fdidx == NULL) { | 107 | if (srv->fdidx == NULL) { | |
108 | log_crit("Failed to allocate fd index"); | 108 | log_crit("Failed to allocate fd index"); | |
109 | goto fail; | 109 | goto fail; | |
110 | } | 110 | } | |
111 | 111 | |||
112 | srv->ctllen = CMSG_SPACE(SOCKCREDSIZE(MAX_GROUPS)); | 112 | srv->ctllen = CMSG_SPACE(SOCKCREDSIZE(MAX_GROUPS)); | |
113 | srv->ctlbuf = malloc(srv->ctllen); | 113 | srv->ctlbuf = malloc(srv->ctllen); | |
114 | if (srv->ctlbuf == NULL) { | 114 | if (srv->ctlbuf == NULL) { | |
115 | log_crit("Malloc cmsg buffer (len=%d) failed.", srv->ctllen); | 115 | log_crit("Malloc cmsg buffer (len=%zu) failed.", srv->ctllen); | |
116 | goto fail; | 116 | goto fail; | |
117 | } | 117 | } | |
118 | 118 | |||
119 | srv->imtu = SDP_LOCAL_MTU - sizeof(sdp_pdu_t); | 119 | srv->imtu = SDP_LOCAL_MTU - sizeof(sdp_pdu_t); | |
120 | srv->ibuf = malloc(srv->imtu); | 120 | srv->ibuf = malloc(srv->imtu); | |
121 | if (srv->ibuf == NULL) { | 121 | if (srv->ibuf == NULL) { | |
122 | log_crit("Malloc input buffer (imtu=%d) failed.", srv->imtu); | 122 | log_crit("Malloc input buffer (imtu=%d) failed.", srv->imtu); | |
123 | goto fail; | 123 | goto fail; | |
124 | } | 124 | } | |
125 | 125 | |||
126 | srv->omtu = L2CAP_MTU_DEFAULT - sizeof(sdp_pdu_t); | 126 | srv->omtu = L2CAP_MTU_DEFAULT - sizeof(sdp_pdu_t); | |
127 | srv->obuf = malloc(srv->omtu); | 127 | srv->obuf = malloc(srv->omtu); | |
128 | if (srv->obuf == NULL) { | 128 | if (srv->obuf == NULL) { |