mirror of
https://github.com/socketio/socket.io-client-cpp.git
synced 2026-03-24 08:45:13 +00:00
core: fix crash when payload pack_id is not numeric (#440)
This commit is contained in:
parent
da779141a7
commit
6a3bd6a45f
@ -321,7 +321,14 @@ namespace sio
|
|||||||
|
|
||||||
if(pos<json_pos)//we've got pack id.
|
if(pos<json_pos)//we've got pack id.
|
||||||
{
|
{
|
||||||
_pack_id = std::stoi(payload_ptr.substr(pos,json_pos - pos));
|
std::string pack_id_str = payload_ptr.substr(pos, json_pos - pos);
|
||||||
|
|
||||||
|
if (std::all_of(pack_id_str.begin(), pack_id_str.end(), ::isdigit)) {
|
||||||
|
_pack_id = std::stoi(pack_id_str);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_pack_id = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_frame == frame_message && (_type == type_binary_event || _type == type_binary_ack)) {
|
if (_frame == frame_message && (_type == type_binary_event || _type == type_binary_ack)) {
|
||||||
//parse later when all buffers are arrived.
|
//parse later when all buffers are arrived.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user