[Box Backup-commit] COMMIT r1347 - box/chris/general/lib/win32

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Mar 4 20:57:33 GMT 2007


Author: chris
Date: 2007-03-04 20:57:33 +0000 (Sun, 04 Mar 2007)
New Revision: 1347

Modified:
   box/chris/general/lib/win32/emu.cpp
Log:
Use autoconf check for process.h instead of hardcoded platform define.

Fix potential access beyond end of array in short filenames.

Use platform separator instead of assuming that it's a backslash (cleaner).


Modified: box/chris/general/lib/win32/emu.cpp
===================================================================
--- box/chris/general/lib/win32/emu.cpp	2007-03-04 20:54:42 UTC (rev 1346)
+++ box/chris/general/lib/win32/emu.cpp	2007-03-04 20:57:33 UTC (rev 1347)
@@ -11,11 +11,14 @@
 #include <fcntl.h>
 #include <windows.h>
 
-#ifdef __MINGW32__
+#ifdef HAVE_UNISTD_H
 	#include <unistd.h>
 #endif
-#include <process.h>
 
+#ifdef HAVE_PROCESS_H
+	#include <process.h>
+#endif
+
 #include <string>
 #include <list>
 
@@ -455,7 +458,7 @@
 	// Absolute paths on Windows are always a drive letter
 	// followed by ':'
 	
-	if (filename[1] != ':')
+	if (filename.length() >= 2 && filename[1] != ':')
 	{
 		// Must be relative. We need to get the 
 		// current directory to make it absolute.
@@ -865,7 +868,7 @@
 	_ui64toa(fi.dwVolumeSerialNumber, s->f_mntonname + 1, 16);
 
 	// pseudo unix mount point
-	s->f_mntonname[0] = '\\';
+	s->f_mntonname[0] = DIRECTORY_SEPARATOR_ASCHAR;
 
 	CloseHandle(handle);   // close the handle
 




More information about the Boxbackup-commit mailing list