Skip to content

Commit c6c54e7

Browse files
awong-devigrr
authored andcommitted
Use correct cast for downcasting reference.
For downcasting, static_cast<> is the appropriate cast. Using reinterpret_cast<> will NOT correctly adjust the `this` pointer and dereferencing such a value is undefined by spec. See [expr.reinterpret.cast]p7 for the relevant passage. The only legal use of this pointer is in another set of reinterpret_cast expressions that either land it into a numeric value, or back to the original type.
1 parent 7b32e6a commit c6c54e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class TLSTraits : public TransportTraits
6363

6464
bool verify(WiFiClient& client, const char* host) override
6565
{
66-
auto wcs = reinterpret_cast<WiFiClientSecure&>(client);
66+
auto wcs = static_cast<WiFiClientSecure&>(client);
6767
return wcs.verify(_fingerprint.c_str(), host);
6868
}
6969

0 commit comments

Comments
 (0)