[nft PATCH v4 05/32] ct: support `NULL` symbol-tables when looking up labels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the symbol-table passed to `ct_label2str` is `NULL`, return `NULL`.

Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 src/ct.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/ct.c b/src/ct.c
index e246d3039240..8c9ae7b0e04a 100644
--- a/src/ct.c
+++ b/src/ct.c
@@ -148,10 +148,11 @@ const char *ct_label2str(const struct symbol_table *ct_label_tbl,
 {
 	const struct symbolic_constant *s;
 
-	for (s = ct_label_tbl->symbols; s->identifier; s++) {
-		if (value == s->value)
-			return s->identifier;
-	}
+	if (ct_label_tbl != NULL)
+		for (s = ct_label_tbl->symbols; s->identifier; s++) {
+			if (value == s->value)
+				return s->identifier;
+		}
 
 	return NULL;
 }
-- 
2.35.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux