Use strlcpy, rather than strmcpy, in expand_twiddle().

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@356 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-08-17 09:28:09 +00:00
parent b80425ce7d
commit d194069da9

View File

@@ -989,7 +989,7 @@ char *BX_expand_twiddle (char *str)
if (*str == '/') if (*str == '/')
#endif #endif
{ {
strmcpy(buffer, my_path, BIG_BUFFER_SIZE/4); strlcpy(buffer, my_path, sizeof buffer);
strmcat(buffer, str, BIG_BUFFER_SIZE/4); strmcat(buffer, str, BIG_BUFFER_SIZE/4);
} }
else else
@@ -1004,16 +1004,16 @@ char *BX_expand_twiddle (char *str)
if (((entry = getpwnam(str)) != NULL) || (p = getenv("HOME"))) if (((entry = getpwnam(str)) != NULL) || (p = getenv("HOME")))
{ {
if (p) if (p)
strmcpy(buffer, p, BIG_BUFFER_SIZE/4); strlcpy(buffer, p, sizeof buffer);
else else
strmcpy(buffer, entry->pw_dir, BIG_BUFFER_SIZE/4); strlcpy(buffer, entry->pw_dir, sizeof buffer);
#else #else
if ((entry = getpwnam(str)) != NULL || (p = getenv("HOME"))) if ((entry = getpwnam(str)) != NULL || (p = getenv("HOME")))
{ {
if (p) if (p)
strmcpy(buffer, p, BIG_BUFFER_SIZE/4); strlcpy(buffer, p, sizeof buffer);
else else
strmcpy(buffer, entry->pw_dir, BIG_BUFFER_SIZE/4); strlcpy(buffer, entry->pw_dir, sizeof buffer);
#endif #endif
if (rest) if (rest)
{ {
@@ -1026,7 +1026,7 @@ char *BX_expand_twiddle (char *str)
} }
} }
else else
strmcpy(buffer, str, BIG_BUFFER_SIZE/4); strlcpy(buffer, str, sizeof buffer);
/* This isnt legal! */ /* This isnt legal! */
str2 = NULL; str2 = NULL;