Showing the changes to interface/src/DataServerClient.cpp (1 of 2 files). Show all
Unified · Split
| @@ -78,8 +78,12 @@ void DataServerClient::getValueForKeyAndUserString(const char* key, QString& use · 77 unmodified lines | ||
| 78 | 78 | |
| 79 | 79 | // pack the key, null terminated |
| 80 | 80 | strcpy((char*) getPacket + numPacketBytes, key); |
| 81 | − numPacketBytes += strlen(key); | |
| 82 | − getPacket[numPacketBytes++] = '\0'; | |
| 81 | + int numKeyBytes = strlen(key); | |
| 82 | + | |
| 83 | + if (numKeyBytes > 0) { | |
| 84 | + numPacketBytes += numKeyBytes; | |
| 85 | + getPacket[numPacketBytes++] = '\0'; | |
| 86 | + } | |
| 83 | 87 | |
| 84 | 88 | // add the getPacket to our vector of uncofirmed packets, will be deleted once we get a response from the nameserver |
| 85 | 89 | _unmatchedPackets.insert(std::pair<unsigned char*, int>(getPacket, numPacketBytes)); |