Committing work for next release (got to do something over lunch aye?)
[m6w6/libmemcached] / lib / memcached_response.c
index 78b314f42dc47864c15cc622ceea7b2a9f25cdba..7402975f895761ade88c41864174b074e630c433 100644 (file)
@@ -42,7 +42,10 @@ memcached_return memcached_response(memcached_st *ptr,
         buffer_ptr++;
 
       total_length++;
-      WATCHPOINT_ASSERT(total_length < buffer_length);
+      WATCHPOINT_ASSERT(total_length <= buffer_length);
+
+      if (total_length >= buffer_length)
+        return MEMCACHED_PROTOCOL_ERROR;
     }
     buffer_ptr++;
     *buffer_ptr= 0;