*/
#include <opensrf/osrf_cache.h>
+#include <ctype.h>
#define MAX_KEY_LEN 250
char* clean_key = (char*)strdup(key);
char* d = clean_key;
char* s = clean_key;
- do while(isspace(*s) || iscntrl(*s)) s++; while(*d++ = *s++);
+ do while(isspace(*s) || ((*s != '\0') && iscntrl(*s))) s++; while(*d++ = *s++);
if (strlen(clean_key) > MAX_KEY_LEN) {
char *hashed = md5sum(clean_key);
clean_key[0] = '\0';
memcached_return rc;
if( key ) {
VA_LIST_TO_STRING(key);
- rc = memcached_delete(_osrfCache, VA_BUF, strlen(VA_BUF), 0 );
+ char* clean_key = _clean_key( VA_BUF );
+ rc = memcached_delete(_osrfCache, clean_key, strlen(clean_key), 0 );
+ free(clean_key);
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED) {
osrfLogDebug(OSRF_LOG_MARK, "Failed to delete key [%s] - %s",
VA_BUF, memcached_strerror(_osrfCache, rc));