Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssh/src/sshbuf-getput-basic.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | int | - | ||||||||||||||||||
9 | sshbuf_get(struct sshbuf *buf, void *v, size_t len) | - | ||||||||||||||||||
10 | { | - | ||||||||||||||||||
11 | const u_char *p = sshbuf_ptr(buf); | - | ||||||||||||||||||
12 | int r; | - | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | if ((
| 1-65 | ||||||||||||||||||
15 | return executed 1 time by 1 test: r;return r; Executed by:
executed 1 time by 1 test: return r; Executed by:
| 1 | ||||||||||||||||||
16 | if (v !=
| 0-65 | ||||||||||||||||||
17 | ((void *)0)
| 0-65 | ||||||||||||||||||
18 | && len != 0
| 32-33 | ||||||||||||||||||
19 | memcpy(v, p, len); executed 33 times by 2 tests: memcpy(v, p, len); Executed by:
| 33 | ||||||||||||||||||
20 | return executed 65 times by 2 tests: 0;return 0; Executed by:
executed 65 times by 2 tests: return 0; Executed by:
| 65 | ||||||||||||||||||
21 | } | - | ||||||||||||||||||
22 | - | |||||||||||||||||||
23 | int | - | ||||||||||||||||||
24 | sshbuf_get_u64(struct sshbuf *buf, u_int64_t *valp) | - | ||||||||||||||||||
25 | { | - | ||||||||||||||||||
26 | const u_char *p = sshbuf_ptr(buf); | - | ||||||||||||||||||
27 | int r; | - | ||||||||||||||||||
28 | - | |||||||||||||||||||
29 | if ((
| 97-1285256 | ||||||||||||||||||
30 | return executed 97 times by 2 tests: r;return r; Executed by:
executed 97 times by 2 tests: return r; Executed by:
| 97 | ||||||||||||||||||
31 | if (valp !=
| 0-1285256 | ||||||||||||||||||
32 | ((void *)0)
| 0-1285256 | ||||||||||||||||||
33 | ) | - | ||||||||||||||||||
34 | * executed 1285256 times by 3 tests: valp = (((u_int64_t)(((const u_char *)(p))[0]) << 56) | ((u_int64_t)(((const u_char *)(p))[1]) << 48) | ((u_int64_t)(((const u_char *)(p))[2]) << 40) | ((u_int64_t)(((const u_char *)(p))[3]) << 32) | ((u_int64_t)(((const u_char *)(p))[4]) << 24) | ((u_int64_t)(((const u_char *)(p))[5]) << 16) | ((u_int64_t)(((const u_char *)(p))[6]) << 8) | (u_int64_t)(((const u_char *)(p))[7]));*valp = (((u_int64_t)(((const u_char *)(p))[0]) << 56) | ((u_int64_t)(((const u_char *)(p))[1]) << 48) | ((u_int64_t)(((const u_char *)(p))[2]) << 40) | ((u_int64_t)(((const u_char *)(p))[3]) << 32) | ((u_int64_t)(((const u_char *)(p))[4]) << 24) | ((u_int64_t)(((const u_char *)(p))[5]) << 16) | ((u_int64_t)(((const u_char *)(p))[6]) << 8) | (u_int64_t)(((const u_char *)(p))[7])); Executed by:
executed 1285256 times by 3 tests: *valp = (((u_int64_t)(((const u_char *)(p))[0]) << 56) | ((u_int64_t)(((const u_char *)(p))[1]) << 48) | ((u_int64_t)(((const u_char *)(p))[2]) << 40) | ((u_int64_t)(((const u_char *)(p))[3]) << 32) | ((u_int64_t)(((const u_char *)(p))[4]) << 24) | ((u_int64_t)(((const u_char *)(p))[5]) << 16) | ((u_int64_t)(((const u_char *)(p))[6]) << 8) | (u_int64_t)(((const u_char *)(p))[7])); Executed by:
| 1285256 | ||||||||||||||||||
35 | return executed 1285256 times by 3 tests: 0;return 0; Executed by:
executed 1285256 times by 3 tests: return 0; Executed by:
| 1285256 | ||||||||||||||||||
36 | } | - | ||||||||||||||||||
37 | - | |||||||||||||||||||
38 | int | - | ||||||||||||||||||
39 | sshbuf_get_u32(struct sshbuf *buf, u_int32_t *valp) | - | ||||||||||||||||||
40 | { | - | ||||||||||||||||||
41 | const u_char *p = sshbuf_ptr(buf); | - | ||||||||||||||||||
42 | int r; | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | if ((
| 18-1329270 | ||||||||||||||||||
45 | return executed 18 times by 2 tests: r;return r; Executed by:
executed 18 times by 2 tests: return r; Executed by:
| 18 | ||||||||||||||||||
46 | if (valp !=
| 320-1328950 | ||||||||||||||||||
47 | ((void *)0)
| 320-1328950 | ||||||||||||||||||
48 | ) | - | ||||||||||||||||||
49 | * executed 1328950 times by 5 tests: valp = (((u_int32_t)(((const u_char *)(p))[0]) << 24) | ((u_int32_t)(((const u_char *)(p))[1]) << 16) | ((u_int32_t)(((const u_char *)(p))[2]) << 8) | (u_int32_t)(((const u_char *)(p))[3]));*valp = (((u_int32_t)(((const u_char *)(p))[0]) << 24) | ((u_int32_t)(((const u_char *)(p))[1]) << 16) | ((u_int32_t)(((const u_char *)(p))[2]) << 8) | (u_int32_t)(((const u_char *)(p))[3])); Executed by:
executed 1328950 times by 5 tests: *valp = (((u_int32_t)(((const u_char *)(p))[0]) << 24) | ((u_int32_t)(((const u_char *)(p))[1]) << 16) | ((u_int32_t)(((const u_char *)(p))[2]) << 8) | (u_int32_t)(((const u_char *)(p))[3])); Executed by:
| 1328950 | ||||||||||||||||||
50 | return executed 1329270 times by 5 tests: 0;return 0; Executed by:
executed 1329270 times by 5 tests: return 0; Executed by:
| 1329270 | ||||||||||||||||||
51 | } | - | ||||||||||||||||||
52 | - | |||||||||||||||||||
53 | int | - | ||||||||||||||||||
54 | sshbuf_get_u16(struct sshbuf *buf, u_int16_t *valp) | - | ||||||||||||||||||
55 | { | - | ||||||||||||||||||
56 | const u_char *p = sshbuf_ptr(buf); | - | ||||||||||||||||||
57 | int r; | - | ||||||||||||||||||
58 | - | |||||||||||||||||||
59 | if ((
| 1-1239381 | ||||||||||||||||||
60 | return executed 1 time by 1 test: r;return r; Executed by:
executed 1 time by 1 test: return r; Executed by:
| 1 | ||||||||||||||||||
61 | if (valp !=
| 0-1239381 | ||||||||||||||||||
62 | ((void *)0)
| 0-1239381 | ||||||||||||||||||
63 | ) | - | ||||||||||||||||||
64 | * executed 1239381 times by 1 test: valp = (((u_int16_t)(((const u_char *)(p))[0]) << 8) | (u_int16_t)(((const u_char *)(p))[1]));*valp = (((u_int16_t)(((const u_char *)(p))[0]) << 8) | (u_int16_t)(((const u_char *)(p))[1])); Executed by:
executed 1239381 times by 1 test: *valp = (((u_int16_t)(((const u_char *)(p))[0]) << 8) | (u_int16_t)(((const u_char *)(p))[1])); Executed by:
| 1239381 | ||||||||||||||||||
65 | return executed 1239381 times by 1 test: 0;return 0; Executed by:
executed 1239381 times by 1 test: return 0; Executed by:
| 1239381 | ||||||||||||||||||
66 | } | - | ||||||||||||||||||
67 | - | |||||||||||||||||||
68 | int | - | ||||||||||||||||||
69 | sshbuf_get_u8(struct sshbuf *buf, u_char *valp) | - | ||||||||||||||||||
70 | { | - | ||||||||||||||||||
71 | const u_char *p = sshbuf_ptr(buf); | - | ||||||||||||||||||
72 | int r; | - | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | if ((
| 1-1275242 | ||||||||||||||||||
75 | return executed 1 time by 1 test: r;return r; Executed by:
executed 1 time by 1 test: return r; Executed by:
| 1 | ||||||||||||||||||
76 | if (valp !=
| 5440-1269802 | ||||||||||||||||||
77 | ((void *)0)
| 5440-1269802 | ||||||||||||||||||
78 | ) | - | ||||||||||||||||||
79 | * executed 1269802 times by 5 tests: valp = (u_int8_t)*p;*valp = (u_int8_t)*p; Executed by:
executed 1269802 times by 5 tests: *valp = (u_int8_t)*p; Executed by:
| 1269802 | ||||||||||||||||||
80 | return executed 1275242 times by 5 tests: 0;return 0; Executed by:
executed 1275242 times by 5 tests: return 0; Executed by:
| 1275242 | ||||||||||||||||||
81 | } | - | ||||||||||||||||||
82 | - | |||||||||||||||||||
83 | int | - | ||||||||||||||||||
84 | sshbuf_get_string(struct sshbuf *buf, u_char **valp, size_t *lenp) | - | ||||||||||||||||||
85 | { | - | ||||||||||||||||||
86 | const u_char *val; | - | ||||||||||||||||||
87 | size_t len; | - | ||||||||||||||||||
88 | int r; | - | ||||||||||||||||||
89 | - | |||||||||||||||||||
90 | if (valp !=
| 3200-1357619 | ||||||||||||||||||
91 | ((void *)0)
| 3200-1357619 | ||||||||||||||||||
92 | ) | - | ||||||||||||||||||
93 | * executed 1357619 times by 6 tests: valp = *valp = ((void *)0) ; Executed by:
executed 1357619 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 1357619 | ||||||||||||||||||
94 | ((void *)0) executed 1357619 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 1357619 | ||||||||||||||||||
95 | ; executed 1357619 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 1357619 | ||||||||||||||||||
96 | if (lenp !=
| 3200-1357619 | ||||||||||||||||||
97 | ((void *)0)
| 3200-1357619 | ||||||||||||||||||
98 | ) | - | ||||||||||||||||||
99 | * executed 1357619 times by 6 tests: lenp = 0;*lenp = 0; Executed by:
executed 1357619 times by 6 tests: *lenp = 0; Executed by:
| 1357619 | ||||||||||||||||||
100 | if ((
| 4725-1356094 | ||||||||||||||||||
101 | return executed 4725 times by 2 tests: r;return r; Executed by:
executed 4725 times by 2 tests: return r; Executed by:
| 4725 | ||||||||||||||||||
102 | if (valp !=
| 3200-1352894 | ||||||||||||||||||
103 | ((void *)0)
| 3200-1352894 | ||||||||||||||||||
104 | ) { | - | ||||||||||||||||||
105 | if ((*
| 0-1352894 | ||||||||||||||||||
106 | ((void *)0)
| 0-1352894 | ||||||||||||||||||
107 | ) { | - | ||||||||||||||||||
108 | ; | - | ||||||||||||||||||
109 | return never executed: -2;return -2; never executed: return -2; | 0 | ||||||||||||||||||
110 | } | - | ||||||||||||||||||
111 | if (len != 0
| 74-1352820 | ||||||||||||||||||
112 | memcpy(*valp, val, len); executed 1352820 times by 6 tests: memcpy(*valp, val, len); Executed by:
| 1352820 | ||||||||||||||||||
113 | (*valp)[len] = '\0'; | - | ||||||||||||||||||
114 | } executed 1352894 times by 6 tests: end of block Executed by:
| 1352894 | ||||||||||||||||||
115 | if (lenp !=
| 3200-1352894 | ||||||||||||||||||
116 | ((void *)0)
| 3200-1352894 | ||||||||||||||||||
117 | ) | - | ||||||||||||||||||
118 | * executed 1352894 times by 6 tests: lenp = len;*lenp = len; Executed by:
executed 1352894 times by 6 tests: *lenp = len; Executed by:
| 1352894 | ||||||||||||||||||
119 | return executed 1356094 times by 6 tests: 0;return 0; Executed by:
executed 1356094 times by 6 tests: return 0; Executed by:
| 1356094 | ||||||||||||||||||
120 | } | - | ||||||||||||||||||
121 | - | |||||||||||||||||||
122 | int | - | ||||||||||||||||||
123 | sshbuf_get_string_direct(struct sshbuf *buf, const u_char **valp, size_t *lenp) | - | ||||||||||||||||||
124 | { | - | ||||||||||||||||||
125 | size_t len; | - | ||||||||||||||||||
126 | const u_char *p; | - | ||||||||||||||||||
127 | int r; | - | ||||||||||||||||||
128 | - | |||||||||||||||||||
129 | if (valp !=
| 319661-1378046 | ||||||||||||||||||
130 | ((void *)0)
| 319661-1378046 | ||||||||||||||||||
131 | ) | - | ||||||||||||||||||
132 | * executed 1378046 times by 6 tests: valp = *valp = ((void *)0) ; Executed by:
executed 1378046 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 1378046 | ||||||||||||||||||
133 | ((void *)0) executed 1378046 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 1378046 | ||||||||||||||||||
134 | ; executed 1378046 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 1378046 | ||||||||||||||||||
135 | if (lenp !=
| 319661-1378046 | ||||||||||||||||||
136 | ((void *)0)
| 319661-1378046 | ||||||||||||||||||
137 | ) | - | ||||||||||||||||||
138 | * executed 1378046 times by 6 tests: lenp = 0;*lenp = 0; Executed by:
executed 1378046 times by 6 tests: *lenp = 0; Executed by:
| 1378046 | ||||||||||||||||||
139 | if ((
| 6304-1691403 | ||||||||||||||||||
140 | return executed 6304 times by 2 tests: r;return r; Executed by:
executed 6304 times by 2 tests: return r; Executed by:
| 6304 | ||||||||||||||||||
141 | if (valp !=
| 318927-1372476 | ||||||||||||||||||
142 | ((void *)0)
| 318927-1372476 | ||||||||||||||||||
143 | ) | - | ||||||||||||||||||
144 | * executed 1372476 times by 6 tests: valp = p;*valp = p; Executed by:
executed 1372476 times by 6 tests: *valp = p; Executed by:
| 1372476 | ||||||||||||||||||
145 | if (lenp !=
| 318927-1372476 | ||||||||||||||||||
146 | ((void *)0)
| 318927-1372476 | ||||||||||||||||||
147 | ) | - | ||||||||||||||||||
148 | * executed 1372476 times by 6 tests: lenp = len;*lenp = len; Executed by:
executed 1372476 times by 6 tests: *lenp = len; Executed by:
| 1372476 | ||||||||||||||||||
149 | if (sshbuf_consume(buf, len + 4) != 0
| 0-1691403 | ||||||||||||||||||
150 | - | |||||||||||||||||||
151 | ; | - | ||||||||||||||||||
152 | ; | - | ||||||||||||||||||
153 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
154 | } | - | ||||||||||||||||||
155 | return executed 1691403 times by 6 tests: 0;return 0; Executed by:
executed 1691403 times by 6 tests: return 0; Executed by:
| 1691403 | ||||||||||||||||||
156 | } | - | ||||||||||||||||||
157 | - | |||||||||||||||||||
158 | int | - | ||||||||||||||||||
159 | sshbuf_peek_string_direct(const struct sshbuf *buf, const u_char **valp, | - | ||||||||||||||||||
160 | size_t *lenp) | - | ||||||||||||||||||
161 | { | - | ||||||||||||||||||
162 | u_int32_t len; | - | ||||||||||||||||||
163 | const u_char *p = sshbuf_ptr(buf); | - | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | if (valp !=
| 64-4617117 | ||||||||||||||||||
166 | ((void *)0)
| 64-4617117 | ||||||||||||||||||
167 | ) | - | ||||||||||||||||||
168 | * executed 4617117 times by 6 tests: valp = *valp = ((void *)0) ; Executed by:
executed 4617117 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 4617117 | ||||||||||||||||||
169 | ((void *)0) executed 4617117 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 4617117 | ||||||||||||||||||
170 | ; executed 4617117 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 4617117 | ||||||||||||||||||
171 | if (lenp !=
| 64-4617117 | ||||||||||||||||||
172 | ((void *)0)
| 64-4617117 | ||||||||||||||||||
173 | ) | - | ||||||||||||||||||
174 | * executed 4617117 times by 6 tests: lenp = 0;*lenp = 0; Executed by:
executed 4617117 times by 6 tests: *lenp = 0; Executed by:
| 4617117 | ||||||||||||||||||
175 | if (sshbuf_len(buf) < 4
| 343-4616838 | ||||||||||||||||||
176 | ; | - | ||||||||||||||||||
177 | return executed 343 times by 1 test: -3;return -3; Executed by:
executed 343 times by 1 test: return -3; Executed by:
| 343 | ||||||||||||||||||
178 | } | - | ||||||||||||||||||
179 | len = (((u_int32_t)(((const u_char *)(p))[0]) << 24) | ((u_int32_t)(((const u_char *)(p))[1]) << 16) | ((u_int32_t)(((const u_char *)(p))[2]) << 8) | (u_int32_t)(((const u_char *)(p))[3])); | - | ||||||||||||||||||
180 | if (len > 0x8000000 - 4
| 2130983-2485855 | ||||||||||||||||||
181 | ; | - | ||||||||||||||||||
182 | return executed 2485855 times by 2 tests: -6;return -6; Executed by:
executed 2485855 times by 2 tests: return -6; Executed by:
| 2485855 | ||||||||||||||||||
183 | } | - | ||||||||||||||||||
184 | if (sshbuf_len(buf) - 4 < len
| 15093-2115890 | ||||||||||||||||||
185 | ; | - | ||||||||||||||||||
186 | return executed 15093 times by 2 tests: -3;return -3; Executed by:
executed 15093 times by 2 tests: return -3; Executed by:
| 15093 | ||||||||||||||||||
187 | } | - | ||||||||||||||||||
188 | if (valp !=
| 64-2115826 | ||||||||||||||||||
189 | ((void *)0)
| 64-2115826 | ||||||||||||||||||
190 | ) | - | ||||||||||||||||||
191 | * executed 2115826 times by 6 tests: valp = p + 4;*valp = p + 4; Executed by:
executed 2115826 times by 6 tests: *valp = p + 4; Executed by:
| 2115826 | ||||||||||||||||||
192 | if (lenp !=
| 64-2115826 | ||||||||||||||||||
193 | ((void *)0)
| 64-2115826 | ||||||||||||||||||
194 | ) | - | ||||||||||||||||||
195 | * executed 2115826 times by 6 tests: lenp = len;*lenp = len; Executed by:
executed 2115826 times by 6 tests: *lenp = len; Executed by:
| 2115826 | ||||||||||||||||||
196 | return executed 2115890 times by 6 tests: 0;return 0; Executed by:
executed 2115890 times by 6 tests: return 0; Executed by:
| 2115890 | ||||||||||||||||||
197 | } | - | ||||||||||||||||||
198 | - | |||||||||||||||||||
199 | int | - | ||||||||||||||||||
200 | sshbuf_get_cstring(struct sshbuf *buf, char **valp, size_t *lenp) | - | ||||||||||||||||||
201 | { | - | ||||||||||||||||||
202 | size_t len; | - | ||||||||||||||||||
203 | const u_char *p, *z; | - | ||||||||||||||||||
204 | int r; | - | ||||||||||||||||||
205 | - | |||||||||||||||||||
206 | if (valp !=
| 0-274625 | ||||||||||||||||||
207 | ((void *)0)
| 0-274625 | ||||||||||||||||||
208 | ) | - | ||||||||||||||||||
209 | * executed 274625 times by 6 tests: valp = *valp = ((void *)0) ; Executed by:
executed 274625 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 274625 | ||||||||||||||||||
210 | ((void *)0) executed 274625 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 274625 | ||||||||||||||||||
211 | ; executed 274625 times by 6 tests: *valp = ((void *)0) ; Executed by:
| 274625 | ||||||||||||||||||
212 | if (lenp !=
| 15534-259091 | ||||||||||||||||||
213 | ((void *)0)
| 15534-259091 | ||||||||||||||||||
214 | ) | - | ||||||||||||||||||
215 | * executed 15534 times by 2 tests: lenp = 0;*lenp = 0; Executed by:
executed 15534 times by 2 tests: *lenp = 0; Executed by:
| 15534 | ||||||||||||||||||
216 | if ((
| 11053-263572 | ||||||||||||||||||
217 | return executed 11053 times by 2 tests: r;return r; Executed by:
executed 11053 times by 2 tests: return r; Executed by:
| 11053 | ||||||||||||||||||
218 | - | |||||||||||||||||||
219 | if (len > 0
| 1495-262077 | ||||||||||||||||||
220 | (
| 422-261655 | ||||||||||||||||||
221 | ((void *)0)
| 422-261655 | ||||||||||||||||||
222 | && z < p + len - 1
| 35-387 | ||||||||||||||||||
223 | ; | - | ||||||||||||||||||
224 | return executed 387 times by 3 tests: -4;return -4; Executed by:
executed 387 times by 3 tests: return -4; Executed by:
| 387 | ||||||||||||||||||
225 | } | - | ||||||||||||||||||
226 | if ((
| 0-263185 | ||||||||||||||||||
227 | ((void *)0)
| 0-263185 | ||||||||||||||||||
228 | ,
| 0-263185 | ||||||||||||||||||
229 | ((void *)0)
| 0-263185 | ||||||||||||||||||
230 | )) != 0
| 0-263185 | ||||||||||||||||||
231 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
232 | if (valp !=
| 0-263185 | ||||||||||||||||||
233 | ((void *)0)
| 0-263185 | ||||||||||||||||||
234 | ) { | - | ||||||||||||||||||
235 | if ((*
| 0-263185 | ||||||||||||||||||
236 | ((void *)0)
| 0-263185 | ||||||||||||||||||
237 | ) { | - | ||||||||||||||||||
238 | ; | - | ||||||||||||||||||
239 | return never executed: -2;return -2; never executed: return -2; | 0 | ||||||||||||||||||
240 | } | - | ||||||||||||||||||
241 | if (len != 0
| 1495-261690 | ||||||||||||||||||
242 | memcpy(*valp, p, len); executed 261690 times by 6 tests: memcpy(*valp, p, len); Executed by:
| 261690 | ||||||||||||||||||
243 | (*valp)[len] = '\0'; | - | ||||||||||||||||||
244 | } executed 263185 times by 6 tests: end of block Executed by:
| 263185 | ||||||||||||||||||
245 | if (lenp !=
| 15350-247835 | ||||||||||||||||||
246 | ((void *)0)
| 15350-247835 | ||||||||||||||||||
247 | ) | - | ||||||||||||||||||
248 | * executed 15350 times by 2 tests: lenp = (size_t)len;*lenp = (size_t)len; Executed by:
executed 15350 times by 2 tests: *lenp = (size_t)len; Executed by:
| 15350 | ||||||||||||||||||
249 | return executed 263185 times by 6 tests: 0;return 0; Executed by:
executed 263185 times by 6 tests: return 0; Executed by:
| 263185 | ||||||||||||||||||
250 | } | - | ||||||||||||||||||
251 | - | |||||||||||||||||||
252 | int | - | ||||||||||||||||||
253 | sshbuf_get_stringb(struct sshbuf *buf, struct sshbuf *v) | - | ||||||||||||||||||
254 | { | - | ||||||||||||||||||
255 | u_int32_t len; | - | ||||||||||||||||||
256 | u_char *p; | - | ||||||||||||||||||
257 | int r; | - | ||||||||||||||||||
258 | - | |||||||||||||||||||
259 | - | |||||||||||||||||||
260 | - | |||||||||||||||||||
261 | - | |||||||||||||||||||
262 | - | |||||||||||||||||||
263 | - | |||||||||||||||||||
264 | if ((
| 0-64 | ||||||||||||||||||
265 | ((void *)0)
| 0-64 | ||||||||||||||||||
266 | ,
| 0-64 | ||||||||||||||||||
267 | ((void *)0)
| 0-64 | ||||||||||||||||||
268 | )) != 0
| 0-64 | ||||||||||||||||||
269 | (
| 0-64 | ||||||||||||||||||
270 | (
| 0-64 | ||||||||||||||||||
271 | (
| 0-64 | ||||||||||||||||||
272 | return never executed: r;return r; never executed: return r; | 0 | ||||||||||||||||||
273 | return executed 64 times by 1 test: 0;return 0; Executed by:
executed 64 times by 1 test: return 0; Executed by:
| 64 | ||||||||||||||||||
274 | } | - | ||||||||||||||||||
275 | - | |||||||||||||||||||
276 | int | - | ||||||||||||||||||
277 | sshbuf_put(struct sshbuf *buf, const void *v, size_t len) | - | ||||||||||||||||||
278 | { | - | ||||||||||||||||||
279 | u_char *p; | - | ||||||||||||||||||
280 | int r; | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | if ((
| 1-1561867 | ||||||||||||||||||
283 | return executed 1 time by 1 test: r;return r; Executed by:
executed 1 time by 1 test: return r; Executed by:
| 1 | ||||||||||||||||||
284 | if (len != 0
| 26501-1535366 | ||||||||||||||||||
285 | memcpy(p, v, len); executed 1535366 times by 6 tests: memcpy(p, v, len); Executed by:
| 1535366 | ||||||||||||||||||
286 | return executed 1561867 times by 6 tests: 0;return 0; Executed by:
executed 1561867 times by 6 tests: return 0; Executed by:
| 1561867 | ||||||||||||||||||
287 | } | - | ||||||||||||||||||
288 | - | |||||||||||||||||||
289 | int | - | ||||||||||||||||||
290 | sshbuf_putb(struct sshbuf *buf, const struct sshbuf *v) | - | ||||||||||||||||||
291 | { | - | ||||||||||||||||||
292 | return executed 42354 times by 3 tests: sshbuf_put(buf, sshbuf_ptr(v), sshbuf_len(v));return sshbuf_put(buf, sshbuf_ptr(v), sshbuf_len(v)); Executed by:
executed 42354 times by 3 tests: return sshbuf_put(buf, sshbuf_ptr(v), sshbuf_len(v)); Executed by:
| 42354 | ||||||||||||||||||
293 | } | - | ||||||||||||||||||
294 | - | |||||||||||||||||||
295 | int | - | ||||||||||||||||||
296 | sshbuf_putf(struct sshbuf *buf, const char *fmt, ...) | - | ||||||||||||||||||
297 | { | - | ||||||||||||||||||
298 | va_list ap; | - | ||||||||||||||||||
299 | int r; | - | ||||||||||||||||||
300 | - | |||||||||||||||||||
301 | - | |||||||||||||||||||
302 | __builtin_va_start( | - | ||||||||||||||||||
303 | ap | - | ||||||||||||||||||
304 | , | - | ||||||||||||||||||
305 | fmt | - | ||||||||||||||||||
306 | ) | - | ||||||||||||||||||
307 | ; | - | ||||||||||||||||||
308 | r = sshbuf_putfv(buf, fmt, ap); | - | ||||||||||||||||||
309 | - | |||||||||||||||||||
310 | __builtin_va_end( | - | ||||||||||||||||||
311 | ap | - | ||||||||||||||||||
312 | ) | - | ||||||||||||||||||
313 | ; | - | ||||||||||||||||||
314 | return executed 12 times by 2 tests: r;return r; Executed by:
executed 12 times by 2 tests: return r; Executed by:
| 12 | ||||||||||||||||||
315 | } | - | ||||||||||||||||||
316 | - | |||||||||||||||||||
317 | int | - | ||||||||||||||||||
318 | sshbuf_putfv(struct sshbuf *buf, const char *fmt, va_list ap) | - | ||||||||||||||||||
319 | { | - | ||||||||||||||||||
320 | va_list ap2; | - | ||||||||||||||||||
321 | int r, len; | - | ||||||||||||||||||
322 | u_char *p; | - | ||||||||||||||||||
323 | - | |||||||||||||||||||
324 | - | |||||||||||||||||||
325 | __builtin_va_copy( | - | ||||||||||||||||||
326 | ap2 | - | ||||||||||||||||||
327 | , | - | ||||||||||||||||||
328 | ap | - | ||||||||||||||||||
329 | ) | - | ||||||||||||||||||
330 | ; | - | ||||||||||||||||||
331 | if ((
| 0-12 | ||||||||||||||||||
332 | ((void *)0)
| 0-12 | ||||||||||||||||||
333 | , 0, fmt, ap2)) < 0
| 0-12 | ||||||||||||||||||
334 | r = -10; | - | ||||||||||||||||||
335 | goto never executed: out;goto out; never executed: goto out; | 0 | ||||||||||||||||||
336 | } | - | ||||||||||||||||||
337 | if (len == 0
| 0-12 | ||||||||||||||||||
338 | r = 0; | - | ||||||||||||||||||
339 | goto never executed: out;goto out; never executed: goto out; | 0 | ||||||||||||||||||
340 | } | - | ||||||||||||||||||
341 | - | |||||||||||||||||||
342 | __builtin_va_end( | - | ||||||||||||||||||
343 | ap2 | - | ||||||||||||||||||
344 | ) | - | ||||||||||||||||||
345 | ; | - | ||||||||||||||||||
346 | - | |||||||||||||||||||
347 | __builtin_va_copy( | - | ||||||||||||||||||
348 | ap2 | - | ||||||||||||||||||
349 | , | - | ||||||||||||||||||
350 | ap | - | ||||||||||||||||||
351 | ) | - | ||||||||||||||||||
352 | ; | - | ||||||||||||||||||
353 | if ((
| 0-12 | ||||||||||||||||||
354 | goto never executed: out;goto out; never executed: goto out; | 0 | ||||||||||||||||||
355 | if ((
| 0-12 | ||||||||||||||||||
356 | r = -1; | - | ||||||||||||||||||
357 | goto never executed: out;goto out; never executed: goto out; | 0 | ||||||||||||||||||
358 | } | - | ||||||||||||||||||
359 | - | |||||||||||||||||||
360 | if ((
| 0-12 | ||||||||||||||||||
361 | goto never executed: out;goto out; never executed: goto out; | 0 | ||||||||||||||||||
362 | r = 0; | - | ||||||||||||||||||
363 | out: code before this statement executed 12 times by 2 tests: out: Executed by:
| 12 | ||||||||||||||||||
364 | - | |||||||||||||||||||
365 | __builtin_va_end( | - | ||||||||||||||||||
366 | ap2 | - | ||||||||||||||||||
367 | ) | - | ||||||||||||||||||
368 | ; | - | ||||||||||||||||||
369 | return executed 12 times by 2 tests: r;return r; Executed by:
executed 12 times by 2 tests: return r; Executed by:
| 12 | ||||||||||||||||||
370 | } | - | ||||||||||||||||||
371 | - | |||||||||||||||||||
372 | int | - | ||||||||||||||||||
373 | sshbuf_put_u64(struct sshbuf *buf, u_int64_t val) | - | ||||||||||||||||||
374 | { | - | ||||||||||||||||||
375 | u_char *p; | - | ||||||||||||||||||
376 | int r; | - | ||||||||||||||||||
377 | - | |||||||||||||||||||
378 | if ((
| 1-168 | ||||||||||||||||||
379 | return executed 1 time by 1 test: r;return r; Executed by:
executed 1 time by 1 test: return r; Executed by:
| 1 | ||||||||||||||||||
380 | do { const u_int64_t __v = (val); ((u_char *)(p))[0] = (__v >> 56) & 0xff; ((u_char *)(p))[1] = (__v >> 48) & 0xff; ((u_char *)(p))[2] = (__v >> 40) & 0xff; ((u_char *)(p))[3] = (__v >> 32) & 0xff; ((u_char *)(p))[4] = (__v >> 24) & 0xff; ((u_char *)(p))[5] = (__v >> 16) & 0xff; ((u_char *)(p))[6] = (__v >> 8) & 0xff; ((u_char *)(p))[7] = __v & 0xff; } while (0); | - | ||||||||||||||||||
381 | return executed 168 times by 3 tests: 0;return 0; Executed by:
executed 168 times by 3 tests: return 0; Executed by:
| 168 | ||||||||||||||||||
382 | } | - | ||||||||||||||||||
383 | - | |||||||||||||||||||
384 | int | - | ||||||||||||||||||
385 | sshbuf_put_u32(struct sshbuf *buf, u_int32_t val) | - | ||||||||||||||||||
386 | { | - | ||||||||||||||||||
387 | u_char *p; | - | ||||||||||||||||||
388 | int r; | - | ||||||||||||||||||
389 | - | |||||||||||||||||||
390 | if ((
| 2-1721 | ||||||||||||||||||
391 | return executed 2 times by 1 test: r;return r; Executed by:
executed 2 times by 1 test: return r; Executed by:
| 2 | ||||||||||||||||||
392 | do { const u_int32_t __v = (val); ((u_char *)(p))[0] = (__v >> 24) & 0xff; ((u_char *)(p))[1] = (__v >> 16) & 0xff; ((u_char *)(p))[2] = (__v >> 8) & 0xff; ((u_char *)(p))[3] = __v & 0xff; } while (0); | - | ||||||||||||||||||
393 | return executed 1721 times by 4 tests: 0;return 0; Executed by:
executed 1721 times by 4 tests: return 0; Executed by:
| 1721 | ||||||||||||||||||
394 | } | - | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | int | - | ||||||||||||||||||
397 | sshbuf_put_u16(struct sshbuf *buf, u_int16_t val) | - | ||||||||||||||||||
398 | { | - | ||||||||||||||||||
399 | u_char *p; | - | ||||||||||||||||||
400 | int r; | - | ||||||||||||||||||
401 | - | |||||||||||||||||||
402 | if ((
| 1-11 | ||||||||||||||||||
403 | return executed 1 time by 1 test: r;return r; Executed by:
executed 1 time by 1 test: return r; Executed by:
| 1 | ||||||||||||||||||
404 | do { const u_int16_t __v = (val); ((u_char *)(p))[0] = (__v >> 8) & 0xff; ((u_char *)(p))[1] = __v & 0xff; } while (0); | - | ||||||||||||||||||
405 | return executed 11 times by 1 test: 0;return 0; Executed by:
executed 11 times by 1 test: return 0; Executed by:
| 11 | ||||||||||||||||||
406 | } | - | ||||||||||||||||||
407 | - | |||||||||||||||||||
408 | int | - | ||||||||||||||||||
409 | sshbuf_put_u8(struct sshbuf *buf, u_char val) | - | ||||||||||||||||||
410 | { | - | ||||||||||||||||||
411 | u_char *p; | - | ||||||||||||||||||
412 | int r; | - | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | if ((
| 0-8185580 | ||||||||||||||||||
415 | return never executed: r;return r; never executed: return r; | 0 | ||||||||||||||||||
416 | p[0] = val; | - | ||||||||||||||||||
417 | return executed 8185580 times by 5 tests: 0;return 0; Executed by:
executed 8185580 times by 5 tests: return 0; Executed by:
| 8185580 | ||||||||||||||||||
418 | } | - | ||||||||||||||||||
419 | - | |||||||||||||||||||
420 | int | - | ||||||||||||||||||
421 | sshbuf_put_string(struct sshbuf *buf, const void *v, size_t len) | - | ||||||||||||||||||
422 | { | - | ||||||||||||||||||
423 | u_char *d; | - | ||||||||||||||||||
424 | int r; | - | ||||||||||||||||||
425 | - | |||||||||||||||||||
426 | if (len > 0x8000000 - 4
| 1-6826 | ||||||||||||||||||
427 | ; | - | ||||||||||||||||||
428 | return executed 1 time by 1 test: -9;return -9; Executed by:
executed 1 time by 1 test: return -9; Executed by:
| 1 | ||||||||||||||||||
429 | } | - | ||||||||||||||||||
430 | if ((
| 3-6823 | ||||||||||||||||||
431 | return executed 3 times by 1 test: r;return r; Executed by:
executed 3 times by 1 test: return r; Executed by:
| 3 | ||||||||||||||||||
432 | do { const u_int32_t __v = (len); ((u_char *)(d))[0] = (__v >> 24) & 0xff; ((u_char *)(d))[1] = (__v >> 16) & 0xff; ((u_char *)(d))[2] = (__v >> 8) & 0xff; ((u_char *)(d))[3] = __v & 0xff; } while (0); | - | ||||||||||||||||||
433 | if (len != 0
| 493-6330 | ||||||||||||||||||
434 | memcpy(d + 4, v, len); executed 6330 times by 5 tests: memcpy(d + 4, v, len); Executed by:
| 6330 | ||||||||||||||||||
435 | return executed 6823 times by 5 tests: 0;return 0; Executed by:
executed 6823 times by 5 tests: return 0; Executed by:
| 6823 | ||||||||||||||||||
436 | } | - | ||||||||||||||||||
437 | - | |||||||||||||||||||
438 | int | - | ||||||||||||||||||
439 | sshbuf_put_cstring(struct sshbuf *buf, const char *v) | - | ||||||||||||||||||
440 | { | - | ||||||||||||||||||
441 | return executed 3105 times by 5 tests: sshbuf_put_string(buf, v, v == return sshbuf_put_string(buf, v, v == ((void *)0) ? 0 : strlen(v)); Executed by:
executed 3105 times by 5 tests: return sshbuf_put_string(buf, v, v == ((void *)0) ? 0 : strlen(v)); Executed by:
| 3105 | ||||||||||||||||||
442 | ((void *)0) executed 3105 times by 5 tests: return sshbuf_put_string(buf, v, v == ((void *)0) ? 0 : strlen(v)); Executed by:
| 3105 | ||||||||||||||||||
443 | ? 0 : strlen(v)); executed 3105 times by 5 tests: return sshbuf_put_string(buf, v, v == ((void *)0) ? 0 : strlen(v)); Executed by:
| 3105 | ||||||||||||||||||
444 | } | - | ||||||||||||||||||
445 | - | |||||||||||||||||||
446 | int | - | ||||||||||||||||||
447 | sshbuf_put_stringb(struct sshbuf *buf, const struct sshbuf *v) | - | ||||||||||||||||||
448 | { | - | ||||||||||||||||||
449 | return executed 279 times by 4 tests: sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v));return sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v)); Executed by:
executed 279 times by 4 tests: return sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v)); Executed by:
| 279 | ||||||||||||||||||
450 | } | - | ||||||||||||||||||
451 | - | |||||||||||||||||||
452 | int | - | ||||||||||||||||||
453 | sshbuf_froms(struct sshbuf *buf, struct sshbuf **bufp) | - | ||||||||||||||||||
454 | { | - | ||||||||||||||||||
455 | const u_char *p; | - | ||||||||||||||||||
456 | size_t len; | - | ||||||||||||||||||
457 | struct sshbuf *ret; | - | ||||||||||||||||||
458 | int r; | - | ||||||||||||||||||
459 | - | |||||||||||||||||||
460 | if (buf ==
| 0-91140 | ||||||||||||||||||
461 | ((void *)0)
| 0-91140 | ||||||||||||||||||
462 | || bufp ==
| 0-91140 | ||||||||||||||||||
463 | ((void *)0)
| 0-91140 | ||||||||||||||||||
464 | ) | - | ||||||||||||||||||
465 | return never executed: -10;return -10; never executed: return -10; | 0 | ||||||||||||||||||
466 | *bufp = | - | ||||||||||||||||||
467 | ((void *)0) | - | ||||||||||||||||||
468 | ; | - | ||||||||||||||||||
469 | if ((
| 2157-88983 | ||||||||||||||||||
470 | return executed 2157 times by 2 tests: r;return r; Executed by:
executed 2157 times by 2 tests: return r; Executed by:
| 2157 | ||||||||||||||||||
471 | if ((
| 0-88983 | ||||||||||||||||||
472 | ((void *)0)
| 0-88983 | ||||||||||||||||||
473 | ) | - | ||||||||||||||||||
474 | return never executed: -2;return -2; never executed: return -2; | 0 | ||||||||||||||||||
475 | if ((
| 0-88983 | ||||||||||||||||||
476 | (
| 0-88983 | ||||||||||||||||||
477 | sshbuf_free(ret); | - | ||||||||||||||||||
478 | return never executed: r;return r; never executed: return r; | 0 | ||||||||||||||||||
479 | } | - | ||||||||||||||||||
480 | *bufp = ret; | - | ||||||||||||||||||
481 | return executed 88983 times by 4 tests: 0;return 0; Executed by:
executed 88983 times by 4 tests: return 0; Executed by:
| 88983 | ||||||||||||||||||
482 | } | - | ||||||||||||||||||
483 | - | |||||||||||||||||||
484 | int | - | ||||||||||||||||||
485 | sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len) | - | ||||||||||||||||||
486 | { | - | ||||||||||||||||||
487 | u_char *d; | - | ||||||||||||||||||
488 | const u_char *s = (const u_char *)v; | - | ||||||||||||||||||
489 | int r, prepend; | - | ||||||||||||||||||
490 | - | |||||||||||||||||||
491 | if (len > 0x8000000 - 5
| 0-46 | ||||||||||||||||||
492 | ; | - | ||||||||||||||||||
493 | return never executed: -9;return -9; never executed: return -9; | 0 | ||||||||||||||||||
494 | } | - | ||||||||||||||||||
495 | - | |||||||||||||||||||
496 | for (; len > 0
| 2-50 | ||||||||||||||||||
497 | ; executed 6 times by 1 test: ; Executed by:
| 6 | ||||||||||||||||||
498 | - | |||||||||||||||||||
499 | - | |||||||||||||||||||
500 | - | |||||||||||||||||||
501 | - | |||||||||||||||||||
502 | prepend = len > 0
| 2-44 | ||||||||||||||||||
503 | if ((
| 0-46 | ||||||||||||||||||
504 | return never executed: r;return r; never executed: return r; | 0 | ||||||||||||||||||
505 | do { const u_int32_t __v = (len + prepend); ((u_char *)(d))[0] = (__v >> 24) & 0xff; ((u_char *)(d))[1] = (__v >> 16) & 0xff; ((u_char *)(d))[2] = (__v >> 8) & 0xff; ((u_char *)(d))[3] = __v & 0xff; } while (0); | - | ||||||||||||||||||
506 | if (prepend
| 22-24 | ||||||||||||||||||
507 | d[4] = 0; executed 22 times by 2 tests: d[4] = 0; Executed by:
| 22 | ||||||||||||||||||
508 | if (len != 0
| 2-44 | ||||||||||||||||||
509 | memcpy(d + 4 + prepend, s, len); executed 44 times by 2 tests: memcpy(d + 4 + prepend, s, len); Executed by:
| 44 | ||||||||||||||||||
510 | return executed 46 times by 2 tests: 0;return 0; Executed by:
executed 46 times by 2 tests: return 0; Executed by:
| 46 | ||||||||||||||||||
511 | } | - | ||||||||||||||||||
512 | - | |||||||||||||||||||
513 | int | - | ||||||||||||||||||
514 | sshbuf_get_bignum2_bytes_direct(struct sshbuf *buf, | - | ||||||||||||||||||
515 | const u_char **valp, size_t *lenp) | - | ||||||||||||||||||
516 | { | - | ||||||||||||||||||
517 | const u_char *d; | - | ||||||||||||||||||
518 | size_t len, olen; | - | ||||||||||||||||||
519 | int r; | - | ||||||||||||||||||
520 | - | |||||||||||||||||||
521 | if ((
| 65080-1242165 | ||||||||||||||||||
522 | return executed 1242165 times by 2 tests: r;return r; Executed by:
executed 1242165 times by 2 tests: return r; Executed by:
| 1242165 | ||||||||||||||||||
523 | len = olen; | - | ||||||||||||||||||
524 | - | |||||||||||||||||||
525 | if ((len != 0
| 2-65078 | ||||||||||||||||||
526 | return executed 295 times by 2 tests: -5;return -5; Executed by:
executed 295 times by 2 tests: return -5; Executed by:
| 295 | ||||||||||||||||||
527 | - | |||||||||||||||||||
528 | if (len > (16384 / 8) + 1
| 1-64784 | ||||||||||||||||||
529 | (len == (16384 / 8) + 1
| 0-64784 | ||||||||||||||||||
530 | return executed 1 time by 1 test: -7;return -7; Executed by:
executed 1 time by 1 test: return -7; Executed by:
| 1 | ||||||||||||||||||
531 | - | |||||||||||||||||||
532 | while (len > 0
| 12-117796 | ||||||||||||||||||
533 | d++; | - | ||||||||||||||||||
534 | len--; | - | ||||||||||||||||||
535 | } executed 53024 times by 6 tests: end of block Executed by:
| 53024 | ||||||||||||||||||
536 | if (valp !=
| 0-64784 | ||||||||||||||||||
537 | ((void *)0)
| 0-64784 | ||||||||||||||||||
538 | ) | - | ||||||||||||||||||
539 | * executed 64784 times by 6 tests: valp = d;*valp = d; Executed by:
executed 64784 times by 6 tests: *valp = d; Executed by:
| 64784 | ||||||||||||||||||
540 | if (lenp !=
| 0-64784 | ||||||||||||||||||
541 | ((void *)0)
| 0-64784 | ||||||||||||||||||
542 | ) | - | ||||||||||||||||||
543 | * executed 64784 times by 6 tests: lenp = len;*lenp = len; Executed by:
executed 64784 times by 6 tests: *lenp = len; Executed by:
| 64784 | ||||||||||||||||||
544 | if (sshbuf_consume(buf, olen + 4) != 0
| 0-64784 | ||||||||||||||||||
545 | - | |||||||||||||||||||
546 | ; | - | ||||||||||||||||||
547 | ; | - | ||||||||||||||||||
548 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
549 | } | - | ||||||||||||||||||
550 | return executed 64784 times by 6 tests: 0;return 0; Executed by:
executed 64784 times by 6 tests: return 0; Executed by:
| 64784 | ||||||||||||||||||
551 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |