On 07.12.2013 10:40, Andrey Borzenkov wrote:
> В Sat, 07 Dec 2013 09:47:44 +0100
> Vladimir 'φ-coder/phcoder' Serbinenko <phco...@gmail.com> пишет:
> 
>> On 07.12.2013 09:44, Andrey Borzenkov wrote:
>>> +     install_device[grub_strlen (install_device) - 1] = '\0';
>>> +     install_drive = xstrdup (install_device + 1);
>>> +     install_device[grub_strlen (install_device) - 1] = ')';
>>> +        }
>> Bad code. You forgot that grub_strlen changes with your operations. You
>> need to keep explicit pointer.
>>
>>
> 
> Oops. Any reason "our" gnulib is missing xstrndup? It is not the only
> place where it will make things more simple and readable.
> 
xmalloc + memcpy + '\0' terminator in this case does the same, a little
bit more efficiently.
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to