Browse Source

- bugfix, fixed off-by-one because PCRE-lib expects count of string

bytes ,but  a string in C ends with \0, therefore the \0 must be
  removed from this calculation
pull/3/head
Andreas Romeyke 4 years ago
parent
commit
e8c7a103c0
  1. 2
      src/tagrules/check_tag_has_value_matching_regex.c

2
src/tagrules/check_tag_has_value_matching_regex.c

@ -34,7 +34,7 @@ ret_t check_tag_has_value_matching_regex(ctiff_t * ctif, tag_t tag, const char *
int ovector[OVECCOUNT];
/* PCRE_NOTEMPTY: An empty string is not a valid match */
int rc = pcre_exec( re, NULL, val, count, 0,PCRE_NOTEMPTY , ovector, OVECCOUNT);
int rc = pcre_exec( re, NULL, val, count-1, 0,PCRE_NOTEMPTY, ovector, OVECCOUNT);
#ifdef DEBUG
printf("tag %s with count=%d and value='%s' -> rc=%d\n", TIFFTagName(tag), count, val, rc);
#endif

Loading…
Cancel
Save