Bug #255 user() function seems to cut last character from the host:
Submitted: 8 Apr 2003 15:51 Modified: 9 Apr 2003 7:29
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Any
Assigned to: CPU Architecture:Any

[8 Apr 2003 15:51] Peter Zaitsev
Description:
It looks like last character is cut from user() function result.

Might be some problem with length calculation?

How to repeat:
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> select user();
+---------------+
| user()        |
+---------------+
| root@localhos |
+---------------+
1 row in set (0.00 sec)
[9 Apr 2003 7:29] MySQL Verification Team
Thanks for your bug report which helped us fix a bug.

This is a patch:
===== sql/item_strfunc.cc 1.99 vs edited =====
*** /tmp/item_strfunc.cc-1.99-5824      Fri Apr  4 12:10:21 2003
--- edited/sql/item_strfunc.cc  Wed Apr  9 17:25:09 2003
***************
*** 1461,1467 ****
    // For system threads (e.g. replication SQL thread) user may be empty
    if (!thd->user)
      return &empty_string;
!   uint32       res_length=(strlen(thd->user)+strlen(host)+2) * cs->mbmaxlen;
  
    if (str->alloc(res_length))
    {
--- 1461,1468 ----
    // For system threads (e.g. replication SQL thread) user may be empty
    if (!thd->user)
      return &empty_string;
!   uint32       res_length=(strlen(thd->user)+strlen(host)+3) * cs->mbmaxlen;
! // it is +3 , because 1 for each string and 1 for '@' sign
  
    if (str->alloc(res_length))
    {