1 This patch fixes an issues where temporary files were created in an insecure
4 It was first intruduced in version 3.8.3-7 and fixes
5 http://bugs.debian.org/438540
9 strcpy(sTempFile, filename.c_str());
10 strcat(sTempFile, sTmpSuffix.c_str());
12 -#if ((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP))
13 - // This section is for Windows folk && gcc 3.x folk
14 +#if !defined(HAVE_MKSTEMP)
15 + // This section is for Windows folk
17 createFile(sTempFile, tmpOut);
20 tmpOut.write((char *)tmpBuffer, nBytes);
23 -#else //((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP))
24 +#else //!defined(HAVE_MKSTEMP)
26 // else we gotta make a temp file, copy the tag into it, copy the
27 // rest of the old file after the tag, delete the old file, rename
29 //ID3_THROW_DESC(ID3E_NoFile, "couldn't open temp file");
32 - ofstream tmpOut(fd);
33 + ofstream tmpOut(sTempFile);
38 uchar tmpBuffer[BUFSIZ];
41 - file.read(tmpBuffer, BUFSIZ);
42 + file.read((char *)tmpBuffer, BUFSIZ);
43 size_t nBytes = file.gcount();
44 - tmpOut.write(tmpBuffer, nBytes);
45 + tmpOut.write((char *)tmpBuffer, nBytes);
48 close(fd); //closes the file
50 -#endif ////((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP))
51 +#endif ////!defined(HAVE_MKSTEMP)