From: ellson Date: Fri, 4 Aug 2006 13:20:02 +0000 (+0000) Subject: - make xml_string() rubust aginst null string pointers X-Git-Tag: LAST_LIBGRAPH~32^2~6005 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0bdb563d6d22e418e4aef847230025670010870;p=graphviz - make xml_string() rubust aginst null string pointers - fix login in map output that was leaving extra '"' in output --- diff --git a/lib/common/labels.c b/lib/common/labels.c index b522c6cc5..52a4b409c 100644 --- a/lib/common/labels.c +++ b/lib/common/labels.c @@ -492,7 +492,7 @@ char *xml_string(char *s) } p = buf; - while (*s) { + while (s && *s) { if (pos > (bufsize - 8)) { bufsize *= 2; buf = grealloc(buf, bufsize); diff --git a/plugin/core/gvrender_core_map.c b/plugin/core/gvrender_core_map.c index e9d2769b8..3e68058a4 100644 --- a/plugin/core/gvrender_core_map.c +++ b/plugin/core/gvrender_core_map.c @@ -101,14 +101,16 @@ static void map_output_shape (GVJ_t *job, map_shape_t map_shape, pointf * AF, in core_fputs(job, xml_string(url)); core_fputs(job, "\""); } - if (target && target[0]) + if (target && target[0]) { core_fputs(job, " target=\""); core_fputs(job, xml_string(target)); core_fputs(job, "\""); - if (tooltip && tooltip[0]) + } + if (tooltip && tooltip[0]) { core_fputs(job, " title=\""); core_fputs(job, xml_string(tooltip)); core_fputs(job, "\""); + } /* * alt text is intended for the visually impaired, but such * folk are not likely to be clicking around on a graph anyway.