Fix incorrect truncation in cluster() caused by strlcpy().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@377 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -3179,6 +3179,7 @@ char *cluster (char *hostname)
|
|||||||
if (!hostname)
|
if (!hostname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
*result = 0;
|
||||||
atsign = strchr(hostname, '@');
|
atsign = strchr(hostname, '@');
|
||||||
if (atsign) {
|
if (atsign) {
|
||||||
if (*hostname == '~') {
|
if (*hostname == '~') {
|
||||||
@@ -3188,17 +3189,13 @@ char *cluster (char *hostname)
|
|||||||
|
|
||||||
if (ident_len <= 9) {
|
if (ident_len <= 9) {
|
||||||
/* copy ident@ */
|
/* copy ident@ */
|
||||||
strlcpy(result, hostname, ident_len + 1);
|
strncat(result, hostname, ident_len + 1);
|
||||||
} else {
|
} else {
|
||||||
strlcpy(result, hostname, 8);
|
strncat(result, hostname, 8);
|
||||||
result[8] = '*';
|
strcat(result, "*@");
|
||||||
result[9] = '@';
|
|
||||||
result[10] = '\0';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hostname = atsign + 1;
|
hostname = atsign + 1;
|
||||||
} else {
|
|
||||||
*result = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(temphost, hostname, sizeof temphost);
|
strlcpy(temphost, hostname, sizeof temphost);
|
||||||
|
|||||||
Reference in New Issue
Block a user