<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1448,7 +1448,7 @@ static void process_bin_update(conn *c) {
     }
 
     if (settings.detail_enabled) {
-        stats_prefix_record_set(key);
+        stats_prefix_record_set(key, nkey);
     }
 
     it = item_alloc(key, nkey, req-&gt;message.body.flags,
@@ -1510,7 +1510,7 @@ static void process_bin_append_prepend(conn *c) {
     }
 
     if (settings.detail_enabled) {
-        stats_prefix_record_set(key);
+        stats_prefix_record_set(key, nkey);
     }
 
     it = item_alloc(key, nkey, 0, 0, vlen+2);
@@ -1583,7 +1583,7 @@ static void process_bin_delete(conn *c) {
     }
 
     if (settings.detail_enabled) {
-        stats_prefix_record_delete(key);
+        stats_prefix_record_delete(key, nkey);
     }
 
     it = item_get(key, nkey);
@@ -2160,7 +2160,7 @@ static inline void process_get_command(conn *c, token_t *tokens, size_t ntokens,
             stats_get_cmds++;
             it = item_get(key, nkey);
             if (settings.detail_enabled) {
-                stats_prefix_record_get(key, NULL != it);
+                stats_prefix_record_get(key, nkey, NULL != it);
             }
             if (it) {
                 if (i &gt;= c-&gt;isize) {
@@ -2338,7 +2338,7 @@ static void process_update_command(conn *c, token_t *tokens, const size_t ntoken
     }
 
     if (settings.detail_enabled) {
-        stats_prefix_record_set(key);
+        stats_prefix_record_set(key, nkey);
     }
 
     if (settings.managed) {
@@ -2521,7 +2521,7 @@ static void process_delete_command(conn *c, token_t *tokens, const size_t ntoken
     }
 
     if (settings.detail_enabled) {
-        stats_prefix_record_delete(key);
+        stats_prefix_record_delete(key, nkey);
     }
 
     it = item_get(key, nkey);</diff>
      <filename>memcached.c</filename>
    </modified>
    <modified>
      <diff>@@ -66,14 +66,14 @@ void stats_prefix_clear() {
  * in the list.
  */
 /*@null@*/
-static PREFIX_STATS *stats_prefix_find(const char *key) {
+static PREFIX_STATS *stats_prefix_find(const char *key, const size_t nkey) {
     PREFIX_STATS *pfs;
     uint32_t hashval;
     size_t length;
 
     assert(key != NULL);
 
-    for (length = 0; key[length] != '\0'; length++)
+    for (length = 0; key[length] != '\0' &amp;&amp; length &lt; nkey; length++)
         if (key[length] == settings.prefix_delimiter)
             break;
 
@@ -113,11 +113,11 @@ static PREFIX_STATS *stats_prefix_find(const char *key) {
 /*
  * Records a &quot;get&quot; of a key.
  */
-void stats_prefix_record_get(const char *key, const bool is_hit) {
+void stats_prefix_record_get(const char *key, const size_t nkey, const bool is_hit) {
     PREFIX_STATS *pfs;
 
     STATS_LOCK();
-    pfs = stats_prefix_find(key);
+    pfs = stats_prefix_find(key, nkey);
     if (NULL != pfs) {
         pfs-&gt;num_gets++;
         if (is_hit) {
@@ -130,11 +130,11 @@ void stats_prefix_record_get(const char *key, const bool is_hit) {
 /*
  * Records a &quot;delete&quot; of a key.
  */
-void stats_prefix_record_delete(const char *key) {
+void stats_prefix_record_delete(const char *key, const size_t nkey) {
     PREFIX_STATS *pfs;
 
     STATS_LOCK();
-    pfs = stats_prefix_find(key);
+    pfs = stats_prefix_find(key, nkey);
     if (NULL != pfs) {
         pfs-&gt;num_deletes++;
     }
@@ -144,11 +144,11 @@ void stats_prefix_record_delete(const char *key) {
 /*
  * Records a &quot;set&quot; of a key.
  */
-void stats_prefix_record_set(const char *key) {
+void stats_prefix_record_set(const char *key, const size_t nkey) {
     PREFIX_STATS *pfs;
 
     STATS_LOCK();
-    pfs = stats_prefix_find(key);
+    pfs = stats_prefix_find(key, nkey);
     if (NULL != pfs) {
         pfs-&gt;num_sets++;
     }</diff>
      <filename>stats.c</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,8 @@
 /* stats */
 void stats_prefix_init(void);
 void stats_prefix_clear(void);
-void stats_prefix_record_get(const char *key, const bool is_hit);
-void stats_prefix_record_delete(const char *key);
-void stats_prefix_record_set(const char *key);
+void stats_prefix_record_get(const char *key, const size_t nkey, const bool is_hit);
+void stats_prefix_record_delete(const char *key, const size_t nkey);
+void stats_prefix_record_set(const char *key, const size_t nkey);
 /*@null@*/
 char *stats_prefix_dump(int *length);</diff>
      <filename>stats.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b2e7e9093964d427d9f604fd3e2f2ae9950f6e79</id>
    </parent>
  </parents>
  <author>
    <name>Trond Norbye</name>
    <email>Trond.Norbye@sun.com</email>
  </author>
  <url>http://github.com/tmaesaka/memcached/commit/46654a83342e4db851b7a5e5772ff4f11a98c3f5</url>
  <id>46654a83342e4db851b7a5e5772ff4f11a98c3f5</id>
  <committed-date>2009-01-03T00:09:11-08:00</committed-date>
  <authored-date>2008-09-29T04:27:24-07:00</authored-date>
  <message>stats_prefix_* should not assume that all keys are zero-terminated</message>
  <tree>925bb938552159771313f9825f8372acb7f1a876</tree>
  <committer>
    <name>Dustin Sallings</name>
    <email>dustin@spy.net</email>
  </committer>
</commit>
