contains should handle embedded NULs (fix #1732)

This commit is contained in:
Nicolas Williams committed 2019-01-18 22:33:46 -06:00
1 parent 4b4fefa254
commit 61cd6dbb3b
2 files changed
+7 -1

No files matched your search

+2 -1
View File
@@ -1342,7 +1342,8 @@ int jv_contains(jv a, jv b) {
} else if (jv_get_kind(a) == JV_KIND_ARRAY) {
r = jv_array_contains(jv_copy(a), jv_copy(b));
} else if (jv_get_kind(a) == JV_KIND_STRING) {
r = strstr(jv_string_value(a), jv_string_value(b)) != 0;
r = _jq_memmem(jv_string_value(a), jv_string_length_bytes(jv_copy(a)),
jv_string_value(b), jv_string_length_bytes(jv_copy(b))) != 0;
} else {
r = jv_equal(jv_copy(a), jv_copy(b));
}