From 1f8a4bed3960d864b1ccd5197f113f6606c05ef3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 1 Apr 2023 14:11:23 +1030 Subject: [PATCH] bitcoin/script: don't memcmp NULL. Stupid, stupid C committee. Signed-off-by: Rusty Russell --- bitcoin/script.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitcoin/script.c b/bitcoin/script.c index 68a26dd5b..a66c26f97 100644 --- a/bitcoin/script.c +++ b/bitcoin/script.c @@ -884,5 +884,7 @@ bool scripteq(const u8 *s1, const u8 *s2) if (tal_count(s1) != tal_count(s2)) return false; + if (tal_count(s1) == 0) + return true; return memcmp(s1, s2, tal_count(s1)) == 0; }