]> granicus.if.org Git - graphviz/commitdiff
- make xml_string() rubust aginst null string pointers
authorellson <devnull@localhost>
Fri, 4 Aug 2006 13:20:02 +0000 (13:20 +0000)
committerellson <devnull@localhost>
Fri, 4 Aug 2006 13:20:02 +0000 (13:20 +0000)
- fix login in map output that was leaving extra '"' in output

lib/common/labels.c
plugin/core/gvrender_core_map.c

index b522c6cc55e78bef2714202c6c2537c037650557..52a4b409c40c25b7190ec6384b5d76d433152730 100644 (file)
@@ -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);
index e9d2769b8df0023eeda34344916f8022459a2103..3e68058a4271fdb88098aba9cf7b216d4342ebe6 100644 (file)
@@ -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.