Cleanup rename_file() a little bit. Use strlcpy, rather than strmcpy.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@368 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-08-26 08:04:21 +00:00
parent c13b00be0c
commit fafd888528

View File

@@ -1278,12 +1278,9 @@ FILE *f;
int rename_file(char *old_file, char **new_file)
{
char *tmp = NULL;
char buffer[BIG_BUFFER_SIZE+4];
char *c = NULL;
FILE *fp;
char *c, *tmp = NULL;
char buffer[BIG_BUFFER_SIZE];
c = alloca(10);
sprintf(c, "%03i.", getrandom(0, 999));
@@ -1293,7 +1290,7 @@ int rename_file (char *old_file, char **new_file)
malloc_sprintf(&tmp, "%s", c);
malloc_strcat(&tmp, *new_file);
strmcpy(buffer, *new_file, BIG_BUFFER_SIZE);
strlcpy(buffer, *new_file, sizeof buffer);
while ((fp = fopen(tmp, "r")) != NULL)
{
fclose(fp);