gpgme/backport-tests-Fix-segv-in-t-json.c.patch
2024-10-18 17:04:25 +08:00

27 lines
902 B
Diff

From ac4bf86bb65a1e228550cce9314ad17239343c5d Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Tue, 21 May 2024 14:36:07 +0200
Subject: [PATCH] tests: Fix segv in t-json.c
* tests/json/t-json.c (test_contains): Avoid calling recusivly with no child.
---
tests/json/t-json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/json/t-json.c b/tests/json/t-json.c
index e1fb6c1..105b981 100644
--- a/tests/json/t-json.c
+++ b/tests/json/t-json.c
@@ -258,7 +258,7 @@ test_contains (cjson_t needle, cjson_t hay)
fprintf (stderr, "Depth mismatch. Expected child for %s\n",
nonnull (needle->string));
}
- if (test_contains (needle->child, hay->child))
+ else if (test_contains (needle->child, hay->child))
{
int found = 0;
for (cjson_t hit = hay->child; hit; hit = hit->next)
--
2.33.0