Fixed possible overflow in create_mask().
This commit is contained in:
parent
951292abe1
commit
f84476cf87
|
@ -487,19 +487,19 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s.*", mode, p2, domain);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!*@%s.*", mode, p2, domain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s", mode, p2, fullhost);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!*@%s", mode, p2, fullhost);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s.*", mode, p2, username, domain);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!%s@%s.*", mode, p2, username, domain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s", mode, p2, username, fullhost);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!%s@%s", mode, p2, username, fullhost);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -507,26 +507,26 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!*@*%s", mode, p2, domain);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!*@*%s", mode, p2, domain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s", mode, p2, fullhost);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!*@%s", mode, p2, fullhost);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!%s@*%s", mode, p2, username, domain);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!%s@*%s", mode, p2, username, domain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s", mode, p2, username, fullhost);
|
snprintf (tbuf, sizeof (tbuf), "%s%s *!%s@%s", mode, p2, username, fullhost);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
snprintf (tbuf, TBUFSIZE, "%s %s", mode, mask);
|
snprintf (tbuf, sizeof (tbuf), "%s %s", mode, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_strdup (tbuf);
|
return g_strdup (tbuf);
|
||||||
|
|
Loading…
Reference in New Issue