Fix running if built on OS X 10.9
strncpy with in == out causes signal 6 if built on OS X 10.9. (If built on older OS X versions, the game works on 10.9 though.) It was happening in COM_StripExtension during map load.
This commit is contained in:
@@ -76,8 +76,12 @@ COM_StripExtension
|
||||
void COM_StripExtension( const char *in, char *out, int destsize )
|
||||
{
|
||||
const char *dot = strrchr(in, '.'), *slash;
|
||||
|
||||
if (dot && (!(slash = strrchr(in, '/')) || slash < dot))
|
||||
Q_strncpyz(out, in, (destsize < dot-in+1 ? destsize : dot-in+1));
|
||||
destsize = (destsize < dot-in+1 ? destsize : dot-in+1);
|
||||
|
||||
if ( in == out && destsize > 1 )
|
||||
out[destsize-1] = '\0';
|
||||
else
|
||||
Q_strncpyz(out, in, destsize);
|
||||
}
|
||||
|
Reference in New Issue
Block a user