mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Merge pull request #5926
8752b5c
0.10 fix for crashes on OSX 10.6 (Cory Fields)
This commit is contained in:
commit
10c09f98b2
@ -88,8 +88,6 @@ typedef u_int SOCKET;
|
|||||||
#define THREAD_PRIORITY_ABOVE_NORMAL (-2)
|
#define THREAD_PRIORITY_ABOVE_NORMAL (-2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_DECL_STRNLEN == 0
|
size_t strnlen_int( const char *start, size_t max_len);
|
||||||
size_t strnlen( const char *start, size_t max_len);
|
|
||||||
#endif // HAVE_DECL_STRNLEN
|
|
||||||
|
|
||||||
#endif // BITCOIN_COMPAT_H
|
#endif // BITCOIN_COMPAT_H
|
||||||
|
@ -7,12 +7,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
// OSX 10.6 is missing strnlen at runtime, but builds targetting it will still
|
||||||
#if HAVE_DECL_STRNLEN == 0
|
// succeed. Define our own version here to avoid a crash.
|
||||||
size_t strnlen( const char *start, size_t max_len)
|
size_t strnlen_int( const char *start, size_t max_len)
|
||||||
{
|
{
|
||||||
const char *end = (const char *)memchr(start, '\0', max_len);
|
const char *end = (const char *)memchr(start, '\0', max_len);
|
||||||
|
|
||||||
return end ? (size_t)(end - start) : max_len;
|
return end ? (size_t)(end - start) : max_len;
|
||||||
}
|
}
|
||||||
#endif // HAVE_DECL_STRNLEN
|
|
||||||
|
@ -40,7 +40,7 @@ CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSize
|
|||||||
|
|
||||||
std::string CMessageHeader::GetCommand() const
|
std::string CMessageHeader::GetCommand() const
|
||||||
{
|
{
|
||||||
return std::string(pchCommand, pchCommand + strnlen(pchCommand, COMMAND_SIZE));
|
return std::string(pchCommand, pchCommand + strnlen_int(pchCommand, COMMAND_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMessageHeader::IsValid() const
|
bool CMessageHeader::IsValid() const
|
||||||
|
Loading…
Reference in New Issue
Block a user