Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
unix2dos
unix2dos-2.2-segfault.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File unix2dos-2.2-segfault.patch of Package unix2dos
--- unix2dos-2.2/unix2dos.c +++ unix2dos-2.2/unix2dos.c @@ -131,9 +131,9 @@ * RetVal: NULL if failure * file stream otherwise */ -FILE* OpenOutFile(char *ipFN) +FILE* OpenOutFile(int fd) { - return (fopen(ipFN, W_CNTRL)); + return (fdopen(fd, W_CNTRL)); } @@ -207,14 +207,17 @@ char TempPath[16]; struct stat StatBuf; struct utimbuf UTimeBuf; + int fd; /* retrieve ipInFN file date stamp */ if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf)) RetVal = -1; - strcpy (TempPath, "./u2dtmp"); - strcat (TempPath, "XXXXXX"); - mkstemp (TempPath); + strcpy (TempPath, "./u2dtmpXXXXXX"); + if((fd=mkstemp (TempPath)) < 0) { + perror("Can't open output temp file"); + RetVal = -1; + } #ifdef DEBUG fprintf(stderr, "unix2dos: using %s as temp file\n", TempPath); @@ -225,7 +228,7 @@ RetVal = -1; /* can open out file? */ - if ((!RetVal) && (InF) && ((TempF=OpenOutFile(TempPath)) == NULL)) + if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL)) { fclose (InF); RetVal = -1; @@ -243,6 +246,9 @@ if ((TempF) && (fclose(TempF) == EOF)) RetVal = -1; + if(fd>=0) + close(fd); + if ((!RetVal) && (ipFlag->KeepDate)) { UTimeBuf.actime = StatBuf.st_atime; @@ -286,14 +292,17 @@ char TempPath[16]; struct stat StatBuf; struct utimbuf UTimeBuf; + int fd; /* retrieve ipInFN file date stamp */ if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf)) RetVal = -1; - strcpy (TempPath, "./u2dtmp"); - strcat (TempPath, "XXXXXX"); - mkstemp (TempPath); + strcpy (TempPath, "./u2dtmpXXXXXX"); + if((fd=mkstemp (TempPath)) < 0) { + perror("Can't open output temp file"); + RetVal = -1; + } #ifdef DEBUG fprintf(stderr, "unix2dos: using %s as temp file\n", TempPath); @@ -304,7 +313,7 @@ RetVal = -1; /* can open out file? */ - if ((!RetVal) && (InF) && ((TempF=OpenOutFile(TempPath)) == NULL)) + if ((!RetVal) && (InF) && ((TempF=OpenOutFile(fd)) == NULL)) { fclose (InF); RetVal = -1; @@ -322,6 +331,9 @@ if ((TempF) && (fclose(TempF) == EOF)) RetVal = -1; + if(fd>=0) + close(fd); + if ((!RetVal) && (ipFlag->KeepDate)) { UTimeBuf.actime = StatBuf.st_atime;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor