summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--items.c2
-rw-r--r--memcached.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/items.c b/items.c
index 637e5e7..83a2ea3 100644
--- a/items.c
+++ b/items.c
@@ -368,6 +368,8 @@ void item_free(item *it) {
bool item_size_ok(const size_t nkey, const int flags, const int nbytes) {
char prefix[40];
uint8_t nsuffix;
+ if (nbytes < 2)
+ return false;
size_t ntotal = item_make_header(nkey + 1, flags, nbytes,
prefix, &nsuffix);
diff --git a/memcached.c b/memcached.c
index 0f03357..a89df96 100644
--- a/memcached.c
+++ b/memcached.c
@@ -4967,7 +4967,7 @@ static void drive_machine(conn *c) {
case conn_swallow:
/* we are reading sbytes and throwing them away */
- if (c->sbytes == 0) {
+ if (c->sbytes <= 0) {
conn_set_state(c, conn_new_cmd);
break;
}