@@ -255,12 +255,12 @@ static void textual_switchover_peer_check(memcached_server_write_instance_st ins
255
255
if (str_length < buf_length) {
256
256
/* OK */
257
257
memcpy (instance->switchover_peer , startptr, str_length);
258
- instance->switchover_peer [str_length]= ' \0 ' ;
258
+ instance->switchover_peer [str_length]= ' \0 ' ;
259
259
instance->switchover_sidx = -1 ; /* undefined */
260
260
} else {
261
261
/* something is wrong */
262
262
memcpy (instance->switchover_peer , startptr, buf_length-1 );
263
- instance->switchover_peer [buf_length-1 ]= ' \0 ' ;
263
+ instance->switchover_peer [buf_length-1 ]= ' \0 ' ;
264
264
instance->switchover_sidx = 1 ; /* set first slave */
265
265
}
266
266
}
@@ -2002,12 +2002,17 @@ static memcached_return_t textual_coll_smget_value_fetch(memcached_server_write_
2002
2002
/* byte array bkey : starts with 0x */
2003
2003
if (to_read_string[0 ] == ' 0' && to_read_string[1 ] == ' x' )
2004
2004
{
2005
+ if (result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_EXT &&
2006
+ result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_EXT_RANGE)
2007
+ return MEMCACHED_PROTOCOL_ERROR;
2005
2008
memcached_conv_str_to_hex (ptr->root , to_read_string+2 , read_length-2 -1 , &result->sub_keys [i].bkey_ext ); // except '0x' and '\0'
2006
- result->sub_key_type = MEMCACHED_COLL_QUERY_BOP_EXT;
2007
2009
}
2008
2010
/* normal bkey */
2009
2011
else
2010
2012
{
2013
+ if (result->sub_key_type != MEMCACHED_COLL_QUERY_BOP &&
2014
+ result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_RANGE)
2015
+ return MEMCACHED_PROTOCOL_ERROR;
2011
2016
result->sub_keys [i].bkey = strtoull (to_read_string, &string_ptr, 10 );
2012
2017
result->sub_key_type = MEMCACHED_COLL_QUERY_BOP;
2013
2018
}
@@ -2280,7 +2285,8 @@ static memcached_return_t textual_coll_smget_trimmed_key_fetch(memcached_server_
2280
2285
{
2281
2286
memcached_conv_str_to_hex (ptr->root , to_read_string+2 , read_length-2 -1 ,
2282
2287
&result->trimmed_sub_keys [i].bkey_ext ); // except '0x' and '\0'
2283
- if (result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_EXT)
2288
+ if (result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_EXT &&
2289
+ result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_EXT_RANGE)
2284
2290
{
2285
2291
memcached_string_free (&result->trimmed_keys [i]);
2286
2292
return MEMCACHED_PROTOCOL_ERROR;
@@ -2290,7 +2296,8 @@ static memcached_return_t textual_coll_smget_trimmed_key_fetch(memcached_server_
2290
2296
else
2291
2297
{
2292
2298
result->trimmed_sub_keys [i].bkey = strtoull (to_read_string, &string_ptr, 10 );
2293
- if (result->sub_key_type != MEMCACHED_COLL_QUERY_BOP)
2299
+ if (result->sub_key_type != MEMCACHED_COLL_QUERY_BOP &&
2300
+ result->sub_key_type != MEMCACHED_COLL_QUERY_BOP_RANGE)
2294
2301
{
2295
2302
memcached_string_free (&result->trimmed_keys [i]);
2296
2303
return MEMCACHED_PROTOCOL_ERROR;
0 commit comments