Author Topic: Antipodes #1  (Read 7421 times)

0 Members and 1 Guest are viewing this topic.

Offline Echelon9

  • Moderator
  • 210
I'd say that strncpy() followed by a strcat_s() is playing up:
Code: [Select]
Index: code/cfile/cfile.cpp
===================================================================
--- code/cfile/cfile.cpp (revision 5532)
+++ code/cfile/cfile.cpp (working copy)
@@ -164,6 +164,8 @@
 //
 int cfile_init(char *exe_dir, char *cdrom_dir)
 {
+ mprintf(( "cfile_int(): exe_dir '%s'\n", exe_dir ));
+ mprintf(( "cfile_int(): cdrom_dir '%s'\n", cdrom_dir ));
  int i;
 
  // initialize encryption
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5532)
+++ code/freespace2/freespace.cpp (working copy)
@@ -1951,6 +1951,7 @@
 #endif
 
 #ifdef APPLE_APP
+ mprintf(( "game_init(): full_path '%s'\n", full_path ));
  // some OSX hackery to drop us out of the APP the binary is run from
  char *c = NULL;
  c = strstr(full_path, ".app");
@@ -1961,11 +1962,14 @@
  *c = '\0';
  }
  strncpy(whee, full_path, MAX_PATH_LEN-1);
+ mprintf(( "game_init(): whee 1 '%s'\n", whee ));
 #else
  GetCurrentDirectory(MAX_PATH_LEN-1, whee);
 #endif
  strcat_s(whee, DIR_SEPARATOR_STR);
+ mprintf(( "game_init(): whee 2 '%s'\n", whee ));
  strcat_s(whee, EXE_FNAME);
+ mprintf(( "game_init(): whee 3 '%s'\n", whee ));
 
  //Initialize the libraries
  s1 = timer_get_milliseconds();

fs2_open.log
Code: [Select]
==========================================================================
DEBUG SPEW: No debug_filter.cfg found, so only general, error, and warning
categories can be shown and no debug_filter.cfg info will be saved.
==========================================================================
Opened log '/Users/rhyskidd/Library/FS2_Open/data/fs2_open.log', Tue Aug 25 00:07:58 2009 ...
FreeSpace version: 3.6.11
Passed cmdline options:
  <none>
game_init(): full_path '/Applications/Freespace 2 Open'
game_init(): whee 1 '/Applications/Freespace 2 Open'
game_init(): whee 2 '/'
game_init(): whee 3 'fs2.exe'
cfile_int(): exe_dir 'fs2.exe'
cfile_int(): cdrom_dir '(null)'

... and yes, it does seem a little contrived that we add EXE_FNAME ("fs2.exe") to the path string on ALL platforms.

 
Found it:

Line 100 of safe_strings.h
Code: [Select]
#define strcpy_s( ... ) scp_strcpy_s( __FILE__, __LINE__, __VA_ARGS__ )
#define strcat_s( ... ) scp_strcpy_s( __FILE__, __LINE__, __VA_ARGS__ )

should be

Code: [Select]
#define strcpy_s( ... ) scp_strcpy_s( __FILE__, __LINE__, __VA_ARGS__ )
#define strcat_s( ... ) scp_strcat_s( __FILE__, __LINE__, __VA_ARGS__ )

This wasn't caught in Antipodes #1 for some reason (it really is ifdef hell in there - can we stop supporting VC6 at some point? :P ).
(I'm not on a fast enough connection to update/commit atm, can someone else do it?)
STRONGTEA. Why can't the x86 be sane?

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
I thought that was fixed a while back, was this screwed up in more than one place?

Anyway, committed.
« Last Edit: August 24, 2009, 11:56:14 am by chief1983 »
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Echelon9

  • Moderator
  • 210
Code: [Select]
Updated to revision 5534.
I can confirm it is fixored. :)

 
I thought that was fixed a while back, was this screwed up in more than one place?

Anyway, committed.

Me too, me too.
STRONGTEA. Why can't the x86 be sane?