List:Commits« Previous MessageNext Message »
From:Ingo Strüwing Date:May 22 2009 7:19am
Subject:Re: bzr commit into mysql-6.0-backup branch (ingo.struewing:2815)
Bug#42572
View as plain text  
Hi Rafal,

thanks for the review.

Rafal Somla, 21.05.2009 11:36:

...
> Ingo Struewing wrote:
...
>> +    if (m_errno == ER_DB_DROP_RMDIR)
>> +    {
>> +        size_t len= get_name()->length();
>> +        char oldname[FN_REFLEN];
>> +        char newname[FN_REFLEN];
> 
> [2] I think newname buffer should have size FN_REFLEN +
> MY_UUID_STRING_LENGTH + 1 to satisfy my_uuid2str() requirements. This is
> because oldname can take up to FN_REFLEN bytes and then there should
> still be MY_UUID_STRING_LENGTH + 1 bytes left for the uuid.
...
>> +        if (len + 3 + MY_UUID_STRING_LENGTH >= FN_REFLEN)
>> +          goto err; /* purecov: inspected */


And then this "if" can go away, right?

...
>> +        /* Build new name as old + uuid. */
>> +        memcpy(newname, oldname, len);
>> +        newname[len++]= '-';
>> +        my_uuid(uuid);
>> +        my_uuid2str(uuid, newname + len);
> 
> [3] Here, there should be at least MY_UUID_STRING_LENGTH + 1 bytes left
> at newname + len.

The "if" above ensured that anyway. But yes, without the extended
buffer, there could be cases, where DROP would fail because the new name
could not be created. A longer buffer can avoid that.

Regards
Ingo
-- 
Ingo Strüwing, Database Group
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schröder,   Wolfgang Engels,   Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring   HRB München 161028
Thread
bzr commit into mysql-6.0-backup branch (ingo.struewing:2815) Bug#42572Ingo Struewing19 May
  • Re: bzr commit into mysql-6.0-backup branch (ingo.struewing:2815)Bug#42572Jørgen Løland20 May
    • Re: bzr commit into mysql-6.0-backup branch (ingo.struewing:2815)Bug#42572Ingo Strüwing20 May
  • Re: bzr commit into mysql-6.0-backup branch (ingo.struewing:2815)Bug#42572Rafal Somla21 May
    • Re: bzr commit into mysql-6.0-backup branch (ingo.struewing:2815)Bug#42572Ingo Strüwing22 May