Commit 4207584
authored
Free existing responderId union arm in OCSP_RESPID setters (#3234)
### Issues:
Addresses V2196133741 (F9 — OCSP_RESPID_set_by_{key,name}: type-confused
free on responderId union)
### Description of changes:
`OCSP_RESPID` stores either an `X509_NAME*` (byName) or an
`ASN1_OCTET_STRING*` (byKey) in a union. Re-setting the responderId
leaked the prior arm or freed it through the wrong destructor, depending
on the transition. Both setters now call a small `ocsp_respid_clear`
helper that frees the arm matching the current `respid->type` before
installing the new value, so every sequence (name↔name, name↔key,
key↔key, key↔name) is correct.
### Call-outs:
None.
### Testing:
Extends `OCSPResponseSignTestExtended.OCSPResponseSign` with four
sequential `OCSP_basic_sign` calls on one `OCSP_BASICRESP`, covering all
four responderId transitions. ASAN in CI will surface any leak or
misuse.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.1 parent 6664239 commit 4207584
2 files changed
Lines changed: 54 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
71 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
72 | 90 | | |
73 | 91 | | |
74 | | - | |
| 92 | + | |
75 | 93 | | |
| 94 | + | |
76 | 95 | | |
77 | 96 | | |
78 | 97 | | |
| |||
95 | 114 | | |
96 | 115 | | |
97 | 116 | | |
| 117 | + | |
98 | 118 | | |
99 | 119 | | |
100 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1293 | 1293 | | |
1294 | 1294 | | |
1295 | 1295 | | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1296 | 1328 | | |
1297 | 1329 | | |
1298 | 1330 | | |
| |||
0 commit comments