We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent da77914 commit afb59a4Copy full SHA for afb59a4
src/internal/sio_packet.cpp
@@ -321,7 +321,14 @@ namespace sio
321
322
if(pos<json_pos)//we've got pack id.
323
{
324
- _pack_id = std::stoi(payload_ptr.substr(pos,json_pos - pos));
+ std::string pack_id_str = payload_ptr.substr(pos, json_pos - pos);
325
+
326
+ if (std::all_of(pack_id_str.begin(), pack_id_str.end(), ::isdigit)) {
327
+ _pack_id = std::stoi(pack_id_str);
328
+ }
329
+ else {
330
+ _pack_id = -1;
331
332
}
333
if (_frame == frame_message && (_type == type_binary_event || _type == type_binary_ack)) {
334
//parse later when all buffers are arrived.
0 commit comments