Commit 9da6f80
committed
crypto: fix use-after-free risk in ManagedX509 assignment
Fixes a potential double-free issue where ManagedX509::operator=
resets the underlying smart pointer using a raw pointer from another
instance before incrementing the reference count. If both instances
were managing the same underlying OpenSSL object, the reset could
decrement the reference count to 0 and free the object before the
reference count could be incremented.
This fixes Coverity issue 367349 where different smart pointers
were seemingly managing the same raw pointer.
Fixes: #569261 parent ed05549 commit 9da6f80
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
0 commit comments