projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
24a2ae8
)
Fixed bug where zero length key was provided.
author
Brian Aker
<brian@tangent.org>
Mon, 12 Nov 2007 08:44:43 +0000
(
00:44
-0800)
committer
Brian Aker
<brian@tangent.org>
Mon, 12 Nov 2007 08:44:43 +0000
(
00:44
-0800)
ChangeLog
patch
|
blob
|
history
include/memcached.h
patch
|
blob
|
history
lib/memcached_auto.c
patch
|
blob
|
history
lib/memcached_delete.c
patch
|
blob
|
history
lib/memcached_get.c
patch
|
blob
|
history
lib/memcached_storage.c
patch
|
blob
|
history
lib/memcached_strerror.c
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index 2b273ae568b1e22bf961db5f1e5484dfd8179a07..136a58df8a31789a47ff28d9bd999136bb3b6661 100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-3,6
+3,7
@@
* different buffers are now kept for different connections to
speed up async efforts
* Modified increment/decrement functions to return uint64_t values
* different buffers are now kept for different connections to
speed up async efforts
* Modified increment/decrement functions to return uint64_t values
+ * Fixed bug in cases where zero length keys were provided
0.8 Mon Nov 5 10:40:41 PST 2007
* Adding support for CRC hash method
0.8 Mon Nov 5 10:40:41 PST 2007
* Adding support for CRC hash method
diff --git
a/include/memcached.h
b/include/memcached.h
index 6bf1e0be4efd5cd718939e83265306d14dc91484..bd056aded456d41163fa1bb5527081f5bc747b86 100644
(file)
--- a/
include/memcached.h
+++ b/
include/memcached.h
@@
-60,6
+60,7
@@
typedef enum {
MEMCACHED_ERRNO,
MEMCACHED_FAIL_UNIX_SOCKET,
MEMCACHED_NOT_SUPPORTED,
MEMCACHED_ERRNO,
MEMCACHED_FAIL_UNIX_SOCKET,
MEMCACHED_NOT_SUPPORTED,
+ MEMCACHED_NO_KEY_PROVIDED,
MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */
} memcached_return;
MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */
} memcached_return;
diff --git
a/lib/memcached_auto.c
b/lib/memcached_auto.c
index ad91f75b47962ccad83e11f19d8eeb6d889d9912..d7e30e568615dd206f0fcbf51a103791fd9df8f0 100644
(file)
--- a/
lib/memcached_auto.c
+++ b/
lib/memcached_auto.c
@@
-11,6
+11,9
@@
static memcached_return memcached_auto(memcached_st *ptr,
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
unsigned int server_key;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
unsigned int server_key;
+ if (key_length == 0)
+ return MEMCACHED_NO_KEY_PROVIDED;
+
if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
return MEMCACHED_NO_SERVERS;
if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
return MEMCACHED_NO_SERVERS;
diff --git
a/lib/memcached_delete.c
b/lib/memcached_delete.c
index 0ed6092a03f0b8114e003ea31d22149d467e9bcc..cedfa442c86d2680b557f5b74a4d8a3393309864 100644
(file)
--- a/
lib/memcached_delete.c
+++ b/
lib/memcached_delete.c
@@
-11,6
+11,9
@@
memcached_return memcached_delete(memcached_st *ptr, char *key, size_t key_lengt
LIBMEMCACHED_MEMCACHED_DELETE_START();
LIBMEMCACHED_MEMCACHED_DELETE_START();
+ if (key_length == 0)
+ return MEMCACHED_NO_KEY_PROVIDED;
+
if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
return MEMCACHED_NO_SERVERS;
if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
return MEMCACHED_NO_SERVERS;
diff --git
a/lib/memcached_get.c
b/lib/memcached_get.c
index c0da409d9750f7539140e0f3a0c325f6c30732ef..70d1b349e9bead5877f44dffd3f0455865565685 100644
(file)
--- a/
lib/memcached_get.c
+++ b/
lib/memcached_get.c
@@
-143,6
+143,9
@@
char *memcached_get(memcached_st *ptr, char *key, size_t key_length,
memcached_string_st *result_buffer;
LIBMEMCACHED_MEMCACHED_GET_START();
memcached_string_st *result_buffer;
LIBMEMCACHED_MEMCACHED_GET_START();
+ if (key_length == 0)
+ return MEMCACHED_NO_KEY_PROVIDED;
+
if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
{
*error= MEMCACHED_NO_SERVERS;
if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
{
*error= MEMCACHED_NO_SERVERS;
diff --git
a/lib/memcached_storage.c
b/lib/memcached_storage.c
index 70201489998f672249d0e6acae60e7d991c4c239..099c78ace119a4a2323f991518667305a85964d8 100644
(file)
--- a/
lib/memcached_storage.c
+++ b/
lib/memcached_storage.c
@@
-36,6
+36,9
@@
static memcached_return memcached_send(memcached_st *ptr,
WATCHPOINT_ASSERT(value);
WATCHPOINT_ASSERT(value_length);
WATCHPOINT_ASSERT(value);
WATCHPOINT_ASSERT(value_length);
+ if (key_length == 0)
+ return MEMCACHED_NO_KEY_PROVIDED;
+
/* Leaving this WATCHPOINT_ASSERT in since only a library fubar could blow this */
#ifdef NOT_DONE
if (!(ptr->flags & MEM_NO_BLOCK) && ptr->write_buffer_offset != 0)
/* Leaving this WATCHPOINT_ASSERT in since only a library fubar could blow this */
#ifdef NOT_DONE
if (!(ptr->flags & MEM_NO_BLOCK) && ptr->write_buffer_offset != 0)
diff --git
a/lib/memcached_strerror.c
b/lib/memcached_strerror.c
index f541c17e4a9f592e5199b66a53bb5202a538a6b7..d2da69638174a5c015a3ab067d83fa1d988f5253 100644
(file)
--- a/
lib/memcached_strerror.c
+++ b/
lib/memcached_strerror.c
@@
-60,6
+60,8
@@
char *memcached_strerror(memcached_st *ptr, memcached_return rc)
return "COULD NOT OPEN UNIX SOCKET";
case MEMCACHED_NOT_SUPPORTED:
return "ACTION NOT SUPPORTED";
return "COULD NOT OPEN UNIX SOCKET";
case MEMCACHED_NOT_SUPPORTED:
return "ACTION NOT SUPPORTED";
+ case MEMCACHED_NO_KEY_PROVIDED:
+ return "A KEY LENGTH OF ZERO WAS PROVIDED";
case MEMCACHED_MAXIMUM_RETURN:
return "Gibberish returned!";
default:
case MEMCACHED_MAXIMUM_RETURN:
return "Gibberish returned!";
default: