summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-02-09 16:56:59 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-02-11 00:15:46 +0000
commite73798976812e652320f096870359ef35ed069ff (patch)
tree0322f221eb757746747a9b20ae2c3620361d6437 /src
parentffc92d69bf2618aca35f2c523abde0a76657e3a2 (diff)
Fix json extract operator for unfound case
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 4dc13ff48..d36d37645 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -3893,7 +3893,8 @@ return NULL;
/* Pull off the leading array or object element, returning
a copy in an allocated string. Update the list pointer.
-The element may itself be an abject or array.
+The element may itself be an object or array.
+Return NULL when the list is empty.
*/
uschar *
@@ -3915,6 +3916,7 @@ for (item = s;
case '}': object_depth--; break;
}
*list = *s ? s+1 : s;
+if (item == s) return NULL;
item = string_copyn(item, s - item);
DEBUG(D_expand) debug_printf_indent(" json ele: '%s'\n", item);
return US item;
@@ -5776,10 +5778,11 @@ while (*s != 0)
}
while (field_number > 0 && (item = json_nextinlist(&list)))
field_number--;
- s = item;
- lookup_value = s;
- while (*s) s++;
- while (--s >= lookup_value && isspace(*s)) *s = '\0';
+ if ((lookup_value = s = item))
+ {
+ while (*s) s++;
+ while (--s >= lookup_value && isspace(*s)) *s = '\0';
+ }
}
else
{