src/network/core/packet.cpp
changeset 7752 60a631bdca68
parent 6247 7d81e3a5d803
child 8113 31b7784db761
equal deleted inserted replaced
7751:d4042cd04555 7752:60a631bdca68
   131  * @param data   the string to send
   131  * @param data   the string to send
   132  */
   132  */
   133 void Packet::Send_string(const char* data)
   133 void Packet::Send_string(const char* data)
   134 {
   134 {
   135 	assert(data != NULL);
   135 	assert(data != NULL);
   136 	assert(this->size < sizeof(this->buffer) - strlen(data) - 1);
   136 	/* The <= *is* valid due to the fact that we are comparing sizes and not the index. */
       
   137 	assert(this->size + strlen(data) + 1 <= sizeof(this->buffer));
   137 	while ((this->buffer[this->size++] = *data++) != '\0') {}
   138 	while ((this->buffer[this->size++] = *data++) != '\0') {}
   138 }
   139 }
   139 
   140 
   140 
   141 
   141 /**
   142 /**