Apply patch from Werner Fink for CVE-2008-3863, CVE-2008-4306