Permalink
Browse files

Check for server key length.

Signed-off-by: Richard Jones <rj@metabrew.com>
  • Loading branch information...
Andrei Zmievski authored and RJ committed Feb 6, 2009
1 parent 8c12442 commit 53d99a8ee4ce6609a6de86621902170600f64585
Showing with 7 additions and 0 deletions.
  1. +7 −0 php_memcached.c
View
@@ -19,6 +19,7 @@
/* TODO
* - set LIBKETAMA_COMPATIBLE as the default?
* - add payload flag for IS_BOOL?
+ * - add getVersion()
*/
#ifdef HAVE_CONFIG_H
@@ -1383,6 +1384,7 @@ PHP_METHOD(Memcached, addServers)
}
}
+ /* catch-all for all errors */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not add entry #%d to the server list", i+1);
}
@@ -1443,6 +1445,11 @@ PHP_METHOD(Memcached, getServerByKey)
return;
}
+ if (server_key_len == 0) {
+ MEMC_G(rescode) = MEMCACHED_BAD_KEY_PROVIDED;
+ RETURN_FALSE;
+ }
+
MEMC_METHOD_FETCH_OBJECT;
MEMC_G(rescode) = MEMCACHED_SUCCESS;

0 comments on commit 53d99a8

Please sign in to comment.