Package: xml2
Tags: patch
Owner: [EMAIL PROTECTED]

----- Forwarded message from Fix <[EMAIL PROTECTED]> -----

From: Fix <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Tue, 8 Jul 2008 23:48:22 +0800
Subject: PATCH: segfault in xml2 (2csv)

Hello,
Patch and description follow.
-----------------------------


--- ./2csv.c.orig       2002-02-07 06:04:36.000000000 +0700
+++ ./2csv.c    2008-07-08 23:31:35.000000000 +0800
@@ -75,20 +75,24 @@
                if (NULL == find || '/' != find[record_len]
                || (buffer != find && '/' != find[-1])) {
                        dump(argc,fields,quote,delimiter);
                        continue;
                }

                for (i = 0; i < argc; ++i) {
                        if (field_len[i] <= len
                        && !strcmp(buffer + len - field_len[i],argv[i])
                        && (field_len[i] == len
-                       ||  '/' == buffer[len - field_len[i] - 1]))
-                               fields[i] = strdup(eq);
+                       ||  '/' == buffer[len - field_len[i] - 1])) {
+                               if (eq)
+                                       fields[i] = strdup(eq);
+                               else
+                                       fields[i] = strdup("");
+                       }
                }

                len = 0;
        }

        dump(argc,fields,quote,delimiter);
        return 0;
 }

DESCRIPTION:

The following chunk causes segfault in 2csv:
--==--
<title-info>
<author>
<first-name>Bertrand</first-name>
<middle-name/>
<last-name>Russell</last-name>
<nickname/>
</author>
</title-info>
--==--

$ xml2 < ...
translates it to:
--==--
/FictionBook/description/title-info/author/first-name=Bertrand
/FictionBook/description/title-info/author/middle-name
/FictionBook/description/title-info/author/last-name=Russell
/FictionBook/description/title-info/author/nickname
--==--

And then
$ 2csv author nickname < ...
segfaults.



----- End forwarded message -----



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to