libxml C fun

Neven Has haski at sezampro.yu
Mon Dec 2 11:44:21 PST 2002


On Mon, Dec 02, 2002 at 03:34:25PM +0000, Mark Ellis wrote:
>          char *xml = NULL;
>          xmlDocPtr xmldoc = NULL;
> 
> /* reads a file and stores it all in a string */
>          xml = read_profile(profile);

That's one big string. :) (If it's a string, see below.)

> 	if (xml == NULL) {
>                  return 0;
> 	}
> 
>          profile_len = strlen(xml)+1;
> 
>          if ((xmldoc = xmlParseMemory(xml, profile_len)) == NULL) {
>                  XFREE(xmlstr);
>                  fprintf(stderr, "Profile parse error : %s\n", profile);
>                  return 0;
>          }

> #8  0x08059848 in xmlParseMemory (buffer=0x8165a48 "", size=135682632) 
> at parser.c:10590

xmlParseMemory("", 135682632) is what's called.

Try printing xml before xmlParseMemory() and checking profile_len
there. Maybe it's not null-terminated or something? Something wrong in
read_profile() probably.


Neven

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list