From 1929bc5c9aaee4de5cd1e3c26462d5efcc53b69c Mon Sep 17 00:00:00 2001 From: ch28745 Date: Thu, 29 May 2025 13:15:39 -0400 Subject: [PATCH] Fix comparison error when NITF_IF "eq NA" is compared against field with length four. Offending source is on line 222 of file modules/c/nitf/shared/CMETAA.c . --- modules/c/nitf/source/TRECursor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/c/nitf/source/TRECursor.c b/modules/c/nitf/source/TRECursor.c index eaeb844e6..f18f3a6cd 100644 --- a/modules/c/nitf/source/TRECursor.c +++ b/modules/c/nitf/source/TRECursor.c @@ -669,7 +669,8 @@ NITFPRIV(int) nitf_TRECursor_evalIf(nitf_TRE* tre, NITF_CTXT, NITF_ERR_INVALID_PARAMETER); return NITF_FAILURE; } - status = strncmp(field->raw, valPtr, field->length); + int valLen = strlen(valPtr); + status = strncmp(field->raw, valPtr, valLen < field->length ? valLen : field->length); status = strcmp(op, "eq") == 0 ? !status : status; } /* check if it is a logical operator for ints */