From 10e2207b8b7757fbd8b9413e3ce11004bc07448f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Fri, 15 Nov 2002 09:17:24 +0100
Subject: [PATCH] (LDATA): Use sizeof instead of strlen. Now handles strings
 including NUL-characters. But works only with literals and character arrays,
 no char pointers. (LLENGTH): New macro, computing length the same way as
 LDATA.

Rev: src/nettle/testsuite/testutils.h:1.16
---
 testsuite/testutils.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testsuite/testutils.h b/testsuite/testutils.h
index b03e8ce8..edc17d51 100644
--- a/testsuite/testutils.h
+++ b/testsuite/testutils.h
@@ -101,7 +101,9 @@ test_dsa_key(struct dsa_public_key *pub,
 #define H(x) decode_hex_dup(x)
 #define HL(x) decode_hex_length(x), decode_hex_dup(x)
 
-#define LDATA(x) strlen(x), x
+/* LDATA needs to handle NUL characters. */
+#define LLENGTH(x) (sizeof(x) - 1)
+#define LDATA(x) (sizeof(x) - 1), x
 #define LDUP(x) strlen(x), strdup(x)
 
 #define MEMEQ(length, a, b) (!memcmp((a), (b), (length)))
-- 
GitLab