Skip to content

Commit

Permalink
Fixed: Malfunctioning M_StrnCat()
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 6, 2012
1 parent 7590bb5 commit 2cc6ac7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/m_misc.c
Expand Up @@ -170,7 +170,7 @@ char* M_StrnCat(char* buf, const char* str, size_t nChars, size_t bufSize)
{
int n = nChars;
int destLen = strlen(buf);
if((int)bufSize - destLen - 1 > n)
if((int)bufSize - destLen - 1 < n)
{
// Cannot copy more than fits in the buffer.
// The 1 is for the null character.
Expand Down
3 changes: 2 additions & 1 deletion doomsday/engine/portable/src/sys_direc.c
Expand Up @@ -348,7 +348,8 @@ boolean Dir_mkpath(const char* path)
M_StrCat(buf, ptr, FILENAME_T_MAXLEN);
else
M_StrnCat(buf, ptr, endptr - ptr, FILENAME_T_MAXLEN);
if(access(buf, 0))

if(buf[0] && access(buf, 0))
{
// Path doesn't exist, create it.
#if defined(WIN32)
Expand Down

0 comments on commit 2cc6ac7

Please sign in to comment.