Use strlcat, rather than strmcat, in BX_path_search.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@404 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1202,13 +1202,12 @@ char *BX_rfgets (char *buffer, int size, FILE *file)
|
|||||||
*/
|
*/
|
||||||
char *BX_path_search (char *name, char *path)
|
char *BX_path_search (char *name, char *path)
|
||||||
{
|
{
|
||||||
static char buffer[BIG_BUFFER_SIZE/2 + 1];
|
char *free_path, *ptr;
|
||||||
char *ptr,
|
static char buffer[BIG_BUFFER_SIZE/2];
|
||||||
*free_path = NULL;
|
|
||||||
|
|
||||||
/* A "relative" path is valid if the file exists */
|
/* A "relative" path is valid if the file exists */
|
||||||
/* A "relative" path is searched in the path if the
|
/* A "relative" path is searched in the path if the
|
||||||
filename doesnt really exist from where we are */
|
filename doesn't really exist from where we are */
|
||||||
if (strchr(name, '/'))
|
if (strchr(name, '/'))
|
||||||
if (!access(name, F_OK))
|
if (!access(name, F_OK))
|
||||||
return name;
|
return name;
|
||||||
@@ -1242,12 +1241,12 @@ char *BX_path_search (char *name, char *path)
|
|||||||
*buffer = 0;
|
*buffer = 0;
|
||||||
if (path[0] == '~')
|
if (path[0] == '~')
|
||||||
{
|
{
|
||||||
strmcat(buffer, my_path, BIG_BUFFER_SIZE/4);
|
strlcat(buffer, my_path, sizeof buffer);
|
||||||
path++;
|
path++;
|
||||||
}
|
}
|
||||||
strmcat(buffer, path, BIG_BUFFER_SIZE/4);
|
strlcat(buffer, path, sizeof buffer);
|
||||||
strmcat(buffer, "/", BIG_BUFFER_SIZE/4);
|
strlcat(buffer, "/", sizeof buffer);
|
||||||
strmcat(buffer, name, BIG_BUFFER_SIZE/4);
|
strlcat(buffer, name, sizeof buffer);
|
||||||
|
|
||||||
if (access(buffer, F_OK) == 0)
|
if (access(buffer, F_OK) == 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user