Created
September 19, 2012 04:47
-
-
Save esetomo/3747729 to your computer and use it in GitHub Desktop.
Miku Miku Online 64bit版Linux用サーバパッチ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/common/network/Utils.hpp | |
+++ b/common/network/Utils.hpp | |
@@ -58,8 +58,8 @@ namespace network { | |
template<> | |
inline std::string GetSerializedValue(const std::string& t) | |
{ | |
- size_t size = t.size(); | |
- return ConvertEndian(std::string(reinterpret_cast<const char*>(&size), sizeof(size_t))) + | |
+ int size = t.size(); | |
+ return ConvertEndian(std::string(reinterpret_cast<const char*>(&size), sizeof(int))) + | |
std::string(t); | |
} | |
@@ -121,8 +121,8 @@ namespace network { | |
template<> | |
inline std::string GetDeserializedValue<std::string>(std::string& buffer) | |
{ | |
- size_t size = *reinterpret_cast<const size_t*>(ConvertEndian(buffer.substr(0, sizeof(size_t))).data()); | |
- buffer.erase(0, sizeof(size_t)); | |
+ int size = *reinterpret_cast<const int*>(ConvertEndian(buffer.substr(0, sizeof(int))).data()); | |
+ buffer.erase(0, sizeof(int)); | |
std::string data(buffer.data(), size); | |
buffer.erase(0, size); | |
return data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
クライアントがデータサイズを4バイトで送信しているが、64bitサーバ側では8バイト分をサイズデータとして解釈してしまうため問題が発生していたようでした。