summaryrefslogtreecommitdiff
path: root/src/libstrongswan/chunk.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/chunk.h')
-rw-r--r--src/libstrongswan/chunk.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstrongswan/chunk.h b/src/libstrongswan/chunk.h
index 146b175d6..7e70a2a2d 100644
--- a/src/libstrongswan/chunk.h
+++ b/src/libstrongswan/chunk.h
@@ -13,7 +13,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * $Id: chunk.h 3868 2008-04-24 13:26:22Z martin $
+ * $Id: chunk.h 4276 2008-08-22 10:44:51Z martin $
*/
/**
@@ -100,7 +100,8 @@ chunk_t chunk_to_hex(chunk_t chunk, char *buf, bool uppercase);
/**
* Convert a hex encoded in a binary chunk.
*
- * If buf is supplied, it must hold at least (hex.len / 2).
+ * If buf is supplied, it must hold at least (hex.len / 2) + (hex.len % 2)
+ * bytes. It is filled by the right to give correct values for short inputs.
*
* @param hex hex encoded input data
* @param buf buffer to write decoded data, NULL to malloc
@@ -164,7 +165,7 @@ void chunk_clear(chunk_t *chunk);
/**
* Clone a chunk on heap
*/
-#define chunk_clone(chunk) chunk_create_clone(malloc(chunk.len), chunk)
+#define chunk_clone(chunk) chunk_create_clone((chunk).len ? malloc(chunk.len) : NULL, chunk)
/**
* Clone a chunk on stack