Skip to content

Instantly share code, notes, and snippets.

@esetomo
Created September 19, 2012 04:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save esetomo/3747729 to your computer and use it in GitHub Desktop.
Save esetomo/3747729 to your computer and use it in GitHub Desktop.
Miku Miku Online 64bit版Linux用サーバパッチ
--- 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;
@esetomo
Copy link
Author

esetomo commented Sep 19, 2012

クライアントがデータサイズを4バイトで送信しているが、64bitサーバ側では8バイト分をサイズデータとして解釈してしまうため問題が発生していたようでした。

@shibacow
Copy link

動きました。ありがとうございました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment