@@ -376,8 +376,8 @@ bool CAuthentication::AssignAgentFlags(CAuthSession* pAuthSession)
376376 if (pAuthSession->nPrevFlags == 0 )
377377 return false ;
378378 // get key type data (in the head of blob data)
379- DWORD dwKeyTypeLen = ConvertEndian (*(( DWORD*) (pAuthSession->lpCurrentKey + 4 ) ));
380- LPCSTR lpszKeyType = ( LPCSTR) (pAuthSession->lpCurrentKey + 8 );
379+ DWORD dwKeyTypeLen = ConvertEndian (*reinterpret_cast < DWORD*> (pAuthSession->lpCurrentKey + 4 ));
380+ LPCSTR lpszKeyType = reinterpret_cast < LPCSTR> (pAuthSession->lpCurrentKey + 8 );
381381
382382 if ((dwKeyTypeLen == 7 && memcmp (lpszKeyType, " ssh-rsa" , dwKeyTypeLen) == 0 ) ||
383383 (dwKeyTypeLen == 28 && memcmp (lpszKeyType, " ssh-rsa-cert-v01@openssh.com" , dwKeyTypeLen) == 0 ))
@@ -431,7 +431,7 @@ AuthReturnType CAuthentication::SSHAuthenticateWithAgent(IEasySFTPAuthentication
431431 pAuthSession->dwSignature = AUTH_SESSION_SIGNATURE;
432432 pAuthSession->pAgent = pAgent;
433433 pAuthSession->lpPageantKeyList = lpKeyList;
434- pAuthSession->dwKeyCount = ConvertEndian (*(( DWORD*) lpKeyList));
434+ pAuthSession->dwKeyCount = ConvertEndian (*reinterpret_cast < DWORD*>( lpKeyList));
435435 pAuthSession->dwKeyIndex = 0 ;
436436 pAuthSession->lpCurrentKey = lpKeyList + 4 ;
437437 pAuthSession->nPrevFlags = -1 ;
@@ -447,18 +447,18 @@ AuthReturnType CAuthentication::SSHAuthenticateWithAgent(IEasySFTPAuthentication
447447 LPCBYTE pBlob;
448448 size_t nBlobLen;
449449
450- nBlobLen = ( size_t ) ConvertEndian (*(( DWORD*)p ));
450+ nBlobLen = static_cast < size_t >( ConvertEndian (*reinterpret_cast < DWORD*>(p) ));
451451 pBlob = (p + 4 );
452452 p += nBlobLen + 4 ;
453453
454454 {
455- DWORD dwKeyTypeLen = ConvertEndian (*(( DWORD*) (pBlob) ));
456- LPCSTR lpszKeyType = ( LPCSTR) (pBlob + 4 );
455+ DWORD dwKeyTypeLen = ConvertEndian (*reinterpret_cast < const DWORD*> (pBlob));
456+ LPCSTR lpszKeyType = reinterpret_cast < LPCSTR> (pBlob + 4 );
457457
458458 // get the comment of key
459- DWORD dwCommentLen = ConvertEndian (*(( DWORD*) p));
460- CMyStringW str;
461- str.SetUTF8String (( LPCBYTE) (p + 4 ), static_cast <size_t >(dwCommentLen));
459+ DWORD dwCommentLen = ConvertEndian (*reinterpret_cast < DWORD*>( p));
460+ CMyStringW str;
461+ str.SetUTF8String (reinterpret_cast < LPCBYTE> (p + 4 ), static_cast <size_t >(dwCommentLen));
462462 p += dwCommentLen + 4 ;
463463 CMyStringW strType, strDebug;
464464 strType.SetString (lpszKeyType, dwKeyTypeLen);
@@ -485,7 +485,7 @@ AuthReturnType CAuthentication::SSHAuthenticateWithAgent(IEasySFTPAuthentication
485485 return LIBSSH2_ERROR_AGENT_PROTOCOL;
486486 }
487487 // skip signature length
488- auto entireLen = ConvertEndian (*(( DWORD*) pSignedData));
488+ auto entireLen = ConvertEndian (*reinterpret_cast < DWORD*>( pSignedData));
489489 pSignedData += 4 ;
490490 nSignedLen -= 4 ;
491491 // skip signing method
@@ -494,7 +494,7 @@ AuthReturnType CAuthentication::SSHAuthenticateWithAgent(IEasySFTPAuthentication
494494 free (buff);
495495 return LIBSSH2_ERROR_AGENT_PROTOCOL;
496496 }
497- auto methodLen = ConvertEndian (*(( DWORD*) pSignedData));
497+ auto methodLen = ConvertEndian (*reinterpret_cast < DWORD*>( pSignedData));
498498 pSignedData += 4 ;
499499 nSignedLen -= 4 ;
500500 if (nSignedLen < methodLen)
@@ -511,7 +511,7 @@ AuthReturnType CAuthentication::SSHAuthenticateWithAgent(IEasySFTPAuthentication
511511 free (buff);
512512 return LIBSSH2_ERROR_AGENT_PROTOCOL;
513513 }
514- auto signatureLen = ConvertEndian (*(( DWORD*) pSignedData));
514+ auto signatureLen = ConvertEndian (*reinterpret_cast < DWORD*>( pSignedData));
515515 pSignedData += 4 ;
516516 nSignedLen -= 4 ;
517517 if (nSignedLen < signatureLen)
0 commit comments