MINOR: samples: adds the bytes converter.

bytes(<offset>[,<length>])
  Extracts a some bytes from an input binary sample. The result is a
  binary sample starting at an offset (in bytes) of the original sample
  and optionnaly truncated at the given length.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index ec412d4..0892bc2 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -10036,6 +10036,11 @@
   transfer binary content in a way that can be reliably transferred (eg:
   an SSL ID can be copied in a header).
 
+bytes(<offset>[,<length>])
+  Extracts some bytes from an input binary sample. The result is a binary
+  sample starting at an offset (in bytes) of the original sample and
+  optionnaly truncated at the given length.
+
 djb2([<avalanche>])
   Hashes a binary input sample into an unsigned 32-bit quantity using the DJB2
   hash function. Optionally, it is possible to apply a full avalanche hash
diff --git a/src/sample.c b/src/sample.c
index be00c3c..02e3961 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -1562,6 +1562,27 @@
 	return 1;
 }
 
+/* This sample function is designed to extract some bytes from an input buffer.
+ * First arg is the offset.
+ * Optional second arg is the length to truncate */
+static int sample_conv_bytes(const struct arg *arg_p, struct sample *smp)
+{
+	if (smp->data.str.len <= arg_p[0].data.uint) {
+		smp->data.str.len = 0;
+		return 1;
+	}
+
+	if (smp->data.str.size)
+			smp->data.str.size -= arg_p[0].data.uint;
+	smp->data.str.len -= arg_p[0].data.uint;
+	smp->data.str.str += arg_p[0].data.uint;
+
+	if ((arg_p[1].type == ARGT_UINT) && (arg_p[1].data.uint < smp->data.str.len))
+		smp->data.str.len = arg_p[1].data.uint;
+
+	return 1;
+}
+
 /************************************************************************/
 /*       All supported sample fetch functions must be declared here     */
 /************************************************************************/
@@ -1703,6 +1724,7 @@
 	{ "sdbm",   sample_conv_sdbm,      ARG1(0,UINT), NULL, SMP_T_BIN,  SMP_T_UINT },
 	{ "wt6",    sample_conv_wt6,       ARG1(0,UINT), NULL, SMP_T_BIN,  SMP_T_UINT },
 	{ "json",   sample_conv_json,      ARG1(1,STR),  sample_conv_json_check, SMP_T_STR,  SMP_T_STR },
+	{ "bytes",  sample_conv_bytes,     ARG2(1,UINT,UINT), NULL, SMP_T_BIN,  SMP_T_BIN },
 	{ NULL, NULL, 0, 0, 0 },
 }};