VirtualBox

Changeset 104444 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Apr 26, 2024 2:08:06 PM (9 months ago)
Author:
vboxsync
Message:

ApplianceImport/OVA: Handle trailing zeros in old ova xml properly for updated libxml2 2.12.6. bugref:10640 bugref:10668

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r101472 r104444  
    26362636    size_t cbBufferedOvf;
    26372637    int vrc = RTVfsIoStrmReadAll(hVfsIosOvf, &pvBufferedOvf, &cbBufferedOvf);
     2638    /*
     2639     * Get rid of trailing zeros if xml is encoded in UTF-8 only. This is needed because
     2640     * starting with libxml2 2.12.6 the parser will complain about extra zeroes beyond
     2641     * the xml string content.
     2642     */
     2643    size_t cbValidXmlBufLen = cbBufferedOvf;
     2644    if (*(uint8_t*)pvBufferedOvf == 0x3C)
     2645        cbValidXmlBufLen = RTStrNLen((const char *)pvBufferedOvf, cbBufferedOvf);
    26382646    uint32_t cRefs = RTVfsIoStrmRelease(hVfsIosOvf);     /* consumes stream handle.  */
    26392647    NOREF(cRefs);
     
    26452653    try
    26462654    {
    2647         m->pReader = new ovf::OVFReader(pvBufferedOvf, cbBufferedOvf, pTask->locInfo.strPath);
     2655        m->pReader = new ovf::OVFReader(pvBufferedOvf, cbValidXmlBufLen, pTask->locInfo.strPath);
    26482656        hrc = S_OK;
    26492657    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette