tests/mem_functions.cc
/*
  Bug found where command total one more than MEMCACHED_MAX_BUFFER
  set key34567890 0 0 8169 \r\n is sent followed by buffer of size 8169, followed by 8169
 */
Bug found where command total one more than MEMCACHED_MAX_BUFFER
set key34567890 0 0 8169 \r\n is sent followed by buffer of size 8169, followed by 8169
Bug found where command total one more than MEMCACHED_MAX_BUFFER set key34567890 0 0 8169 \ r \ n is sent followed by buffer of size 8169 followed by 8169
static test_return_t user_supplied_bug13(memcached_st *memc)
{
  char key[] = "key34567890";
  memcached_return_t rc;
  size_t overflowSize;
  char commandFirst[]= "set key34567890 0 0 ";
  char commandLast[] = " \r\n"; 
  size_t commandLength;
  size_t testSize;
  commandLength = strlen(commandFirst) + strlen(commandLast) + 4; 
  overflowSize = MEMCACHED_MAX_BUFFER - commandLength;
  for (testSize= overflowSize - 1; testSize < overflowSize + 1; testSize++)
  {
    char *overflow= new (std::nothrow) char[testSize];
    test_true(overflow);
    memset(overflow, 'x', testSize);
    rc= memcached_set(memc, key, strlen(key),
                      overflow, testSize, 0, 0);
    test_compare(MEMCACHED_SUCCESS, rc);
    delete [] overflow;
  }
  return TEST_SUCCESS;
}
static test_return_t user_supplied_bug13 ( memcached_st * memc ) { char key [ ] = " " ; memcached_return_t rc ; size_t overflowSize ; char commandFirst [ ] = " " ; char commandLast [ ] = " \r \n " ; size_t commandLength ; size_t testSize ; commandLength = strlen ( commandFirst ) + strlen ( commandLast ) + 4 ; overflowSize = MEMCACHED_MAX_BUFFER - commandLength ; for ( testSize = overflowSize - 1 ; testSize < overflowSize + 1 ; testSize ++ ) { char * overflow = new ( std :: nothrow ) char [ testSize ] ; test_true ( overflow ) ; memset ( overflow , ' ' , testSize ) ; rc = memcached_set ( memc , key , strlen ( key ) , overflow , testSize , 0 , 0 ) ; test_compare ( MEMCACHED_SUCCESS , rc ) ; delete [ ] overflow ; } return TEST_SUCCESS ; }
Bug found where command total one more than MEMCACHED_MAX_BUFFER
set key34567890 0 0 8169 \r\n is sent followed by buffer of size 8169, followed by 8169
Bug found where command total one more than MEMCACHED_MAX_BUFFER set key34567890 0 0 8169 \ r \ n is sent followed by buffer of size 8169 followed by 8169
/* first line of command sent to server */ /* 4 is number of characters in size, probably 8196 */