sitecopy-0.16.6
Nelson Williams Gamazo Sanchez
ngamazo at segurmatica.cu
Fri Apr 24 17:10:30 EDT 2009
Helo
We are using sitecopy for several tasks. Some days ago we detected the following error in the site copy logs:
sitecopy: Error: Corrupt site storage file for `SiteName':
sitecopy: XML parse error at line 4446: parsing finished
sitecopy: Skipping site `SiteName'.
sitecopy: No valid sites specified.
Try `sitecopy --help' for more information.
Researching the problem we found a sitecopy bug parsing xml storage files with size multiple of 512 bytes. The following code section show the error:
***************Current version Sitecopy code in sitestore.c******************:
- In the last 512 bytes len=0
- The function ne_xml_parse is called with len=0 and buffer > 0. The function return the error described in the sitecopy logs.
do {
char buffer[BUFSIZ];
int len;
len = fread(buffer, 1, BUFSIZ, fp);
if (len < BUFSIZ) {
if (feof(fp)) {
ret = 1;
} else if (ferror(fp)) {
ret = -1;
/* And don't parse anything else... */
break;
}
}
ne_xml_parse(p, buffer, len);
} while (ret == 0 && !ne_xml_failed(p));
**************Mitigation****************************:
- test for len=0 and don’t call " ne_xml_parse".
do {
char buffer[BUFSIZ];
int len;
len = fread(buffer, 1, BUFSIZ, fp);
if (len < BUFSIZ) {
if (feof(fp)) {
ret = 1;
} else if (ferror(fp)) {
ret = -1;
/* And don't parse anything else... */
break;
}
}
if(len != 0){
ne_xml_parse(p, buffer, len);
}
} while (ret == 0 && !ne_xml_failed(p));
Kind regards,
nelson
More information about the sitecopy
mailing list