From 5badda97d57dc10f471eb465b4b1503c0eed571c Mon Sep 17 00:00:00 2001 From: Kipp Cannon <kipp.cannon@ligo.org> Date: Tue, 12 Feb 2019 15:25:34 +0900 Subject: [PATCH] ezxml.c: fix undefined expression --- gstlal/lib/gstlal/ezxml.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gstlal/lib/gstlal/ezxml.c b/gstlal/lib/gstlal/ezxml.c index e964b40db6..3e993c50e5 100644 --- a/gstlal/lib/gstlal/ezxml.c +++ b/gstlal/lib/gstlal/ezxml.c @@ -361,7 +361,13 @@ short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len) else *s = '\0'; // null terminate tag name for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++); - while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') { + while (1) { + /* this is the loop condition. it must be split into two + * expressions because otherwise the operations on s are + * undefined */ + s++; + if(!(*(n = s + strspn(s, EZXML_WS)) && *n != '>')) break; + if (*(s = n + strcspn(n, EZXML_WS))) *s = '\0'; // attr name else { ezxml_err(root, t, "malformed <!ATTLIST"); break; } -- GitLab